* (bug 23817, bug 26250) User Service_JSON's native associative array mode in FormatJ...
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 13 Feb 2011 23:08:28 +0000 (23:08 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 13 Feb 2011 23:08:28 +0000 (23:08 +0000)
Patches from Tim Yates on https://bugzilla.wikimedia.org/show_bug.cgi?id=23817

includes/json/FormatJson.php

index 1265314..04024f8 100644 (file)
@@ -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 );