Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -3244,10 +3244,13 @@ |
3245 | 3245 | } |
3246 | 3246 | |
3247 | 3247 | /* 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 ) { |
3249 | 3249 | $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 ) ) ) { |
3252 | 3255 | $value = wfObjectToArray( $value ); |
3253 | 3256 | } |
3254 | 3257 | |