r82090 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82089‎ | r82090 | r82091 >
Date:23:04, 13 February 2011
Author:brion
Status:ok
Tags:
Comment:
* (bug 26250, bug 23817) Fix wfObjectToArray() to descend into arrays; fixes processing of JSON return values for ForeignAPIRepo when native json module not present
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -3244,10 +3244,13 @@
32453245 }
32463246
32473247 /* Recursively converts the parameter (an object) to an array with the same data */
3248 -function wfObjectToArray( $object, $recursive = true ) {
 3248+function wfObjectToArray( $objOrArray, $recursive = true ) {
32493249 $array = array();
3250 - foreach ( get_object_vars( $object ) as $key => $value ) {
3251 - if ( is_object( $value ) && $recursive ) {
 3250+ if( is_object( $objOrArray ) ) {
 3251+ $objOrArray = get_object_vars( $objOrArray );
 3252+ }
 3253+ foreach ( $objOrArray as $key => $value ) {
 3254+ if ( $recursive && ( is_object( $value ) || is_array( $value ) ) ) {
32523255 $value = wfObjectToArray( $value );
32533256 }
32543257

Follow-up revisions

RevisionCommit summaryAuthorDate
r82091* (bug 23817, bug 26250) User Service_JSON's native associative array mode in...brion23:08, 13 February 2011
r821511.17wmf1: MFT r78964, r79086, r79087, r79091, r82004, r82025, r82048, r82070,...catrope22:55, 14 February 2011
r85151MFT: r82000, r82004, r82020, r82025, r82038, r82039, r82048, r82070, r82081, ...demon20:39, 1 April 2011

Status & tagging log