r40384 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40383‎ | r40384 | r40385 >
Date:14:47, 3 September 2008
Author:catrope
Status:old
Tags:
Comment:
(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
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiFormatYaml_spyc.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiFormatYaml_spyc.php
@@ -424,14 +424,14 @@
425425
426426 if (is_int($key)) {
427427 // It's a sequence
428 - if ($value)
 428+ if ($value !== '' && !is_null($value))
429429 $string = $spaces.'- '.$value."\n";
430430 else
431431 $string = $spaces . "-\n";
432432 } else {
433433 // It's mapped
434 - if ($value)
435 - $string = $spaces.$key.': '.$value."\n";
 434+ if ($value !== '' && !is_null($value))
 435+ $string = $spaces . $key . ': ' . $value . "\n";
436436 else
437437 $string = $spaces . $key . ":\n";
438438 }
@@ -589,7 +589,7 @@
590590 $array = $array + $this->_toType($v);
591591 }
592592 $value = $array;
593 - } elseif (strtolower($value) == 'null' or $value == '' or $value == '~') {
 593+ } elseif (strtolower($value) == 'null' or $value === '' or $value == '~') {
594594 $value = NULL;
595595 } elseif (ctype_digit($value)) {
596596 $value = (int)$value;
Index: trunk/phase3/RELEASE-NOTES
@@ -208,8 +208,9 @@
209209 * Database replication lag doesn't cause all action=edit requests to return the
210210 nochange flag any more
211211 * (bug 15392) ApiFormatBase::formatHTML now uses $wgUrlProtocols.
212 -* (bug 15444) action=edit returned "Unknown error: ``AS_END''" where it should
 212+* (bug 15444) action=edit returns "Unknown error: ``AS_END''" where it should
213213 return just "Unknown error"
 214+* (bug 15448) YAML output returns empty values instead of 0
214215
215216 === Languages updated in 1.14 ===
216217

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r32485API: (bug 11719) Remove trailing blanks in YAML output.amidaniel23:19, 26 March 2008