Page MenuHomePhabricator

YAML-Output returns empty values instead of 0
Closed, ResolvedPublic

Description

Author: wikimedia-bugreports

Description:
See for example http://de.wikinews.org/w/api.php?action=query&prop=info&titles=Hauptseite&format=yaml compared to http://de.wikinews.org/w/api.php?action=query&prop=info&titles=Hauptseite

Both the namespace (ns) and the counter variable are numerical zero but in the yaml output the value is just empty.


Version: 1.12.x
Severity: normal

Details

Reference
bz15448

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:18 PM
bzimport set Reference to bz15448.

Upon seeing this bug, my first instinct was that PHP's weak type system was to blame, and that someone had done $var == '' somewhere (which is true if $var is '0'). It turned out there was a == '' in the YAML formatter, but that didn't cause the bug. It was plain, old-fashioned, non-PHP-related stupidity in the form of if($value), which was probably intended to be false for null and empty strings, but is also false for 0 and '0'.

Fixed in r40384.