﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
11963	"json_decode() only supports only ""stdClass Object"" but no ""array"""	carbolineum		"Hi,

to allow the json_decode() function to return ""array"" instead of ""stdClass Object"", normally the second argument to json_decode() is set to TRUE. Wordpress at least 2.9.1 only supports one argument.

So perhaps it may be useful to change the wp-includes/compat.php with the following:


{{{
--- compat.php  2010-01-20 23:42:32.000000000 +0100
+++ compat.php.new      2010-01-20 23:30:18.000000000 +0100
@@ -138,12 +138,19 @@
 }

 if ( !function_exists('json_decode') ) {
-       function json_decode( $string ) {
+       function json_decode( $string, $bool ) {
                global $wp_json;

                if ( !is_a($wp_json, 'Services_JSON') ) {
                        require_once( 'class-json.php' );
-                       $wp_json = new Services_JSON();
+                       if ($bool == TRUE) {
+                               // use associative array
+                               $wp_json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
+                       }
+                       else {
+                               // use stdClass object
+                               $wp_json = new Services_JSON();
+                       }
                }

                return $wp_json->decode( $string );

}}}

Greetings, Michael
"	enhancement	closed	normal	3.0	General	2.9.1	normal	fixed	needs-patch	
