From: Brion Vibber Date: Sun, 13 Feb 2011 23:08:28 +0000 (+0000) Subject: * (bug 23817, bug 26250) User Service_JSON's native associative array mode in FormatJ... X-Git-Tag: 1.31.0-rc.0~32003 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=8982ac25b753646c20bd0ac8f18c26fd7b46afa9;p=lhc%2Fweb%2Fwiklou.git * (bug 23817, bug 26250) User Service_JSON's native associative array mode in FormatJson::decode(), bypassing wfObjectToArray (which is also fixed) Patches from Tim Yates on https://bugzilla.wikimedia.org/show_bug.cgi?id=23817 --- diff --git a/includes/json/FormatJson.php b/includes/json/FormatJson.php index 126531419a..04024f8d54 100644 --- a/includes/json/FormatJson.php +++ b/includes/json/FormatJson.php @@ -49,11 +49,11 @@ class FormatJson { */ public static function decode( $value, $assoc = false ) { if ( !function_exists( 'json_decode' ) ) { - $json = new Services_JSON(); + if( $assoc ) + $json = new Services_JSON( SERVICES_JSON_LOOSE_TYPE ); + else + $json = new Services_JSON(); $jsonDec = $json->decode( $value ); - if( $assoc ) { - $jsonDec = wfObjectToArray( $jsonDec ); - } return $jsonDec; } else { return json_decode( $value, $assoc );