From 8982ac25b753646c20bd0ac8f18c26fd7b46afa9 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 13 Feb 2011 23:08:28 +0000 Subject: [PATCH] * (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 --- includes/json/FormatJson.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 ); -- 2.20.1