From: Roan Kattouw Date: Wed, 3 Sep 2008 14:47:49 +0000 (+0000) Subject: (bug 15448) YAML output returns empty strings instead of 0. Surprisingly, this was... X-Git-Tag: 1.31.0-rc.0~45507 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/journal.php?a=commitdiff_plain;h=1881098b81b48945138821e56a0ae3a3e06b8d48;p=lhc%2Fweb%2Fwiklou.git (bug 15448) YAML output returns empty strings instead of 0. Surprisingly, this was not caused by PHP's "helpful" 0=='' ; research shows this was a regression from r32485 that no one ever noticed --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 1a81d12f1d..69a8f6d1ab 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -208,8 +208,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Database replication lag doesn't cause all action=edit requests to return the nochange flag any more * (bug 15392) ApiFormatBase::formatHTML now uses $wgUrlProtocols. -* (bug 15444) action=edit returned "Unknown error: ``AS_END''" where it should +* (bug 15444) action=edit returns "Unknown error: ``AS_END''" where it should return just "Unknown error" +* (bug 15448) YAML output returns empty values instead of 0 === Languages updated in 1.14 === diff --git a/includes/api/ApiFormatYaml_spyc.php b/includes/api/ApiFormatYaml_spyc.php index c0d4093ec1..1cebbd6b3c 100644 --- a/includes/api/ApiFormatYaml_spyc.php +++ b/includes/api/ApiFormatYaml_spyc.php @@ -424,14 +424,14 @@ if (is_int($key)) { // It's a sequence - if ($value) + if ($value !== '' && !is_null($value)) $string = $spaces.'- '.$value."\n"; else $string = $spaces . "-\n"; } else { // It's mapped - if ($value) - $string = $spaces.$key.': '.$value."\n"; + if ($value !== '' && !is_null($value)) + $string = $spaces . $key . ': ' . $value . "\n"; else $string = $spaces . $key . ":\n"; } @@ -589,7 +589,7 @@ $array = $array + $this->_toType($v); } $value = $array; - } elseif (strtolower($value) == 'null' or $value == '' or $value == '~') { + } elseif (strtolower($value) == 'null' or $value === '' or $value == '~') { $value = NULL; } elseif (ctype_digit($value)) { $value = (int)$value;