ID: 42270 User updated by: steven dot mccoy at miru dot hk Reported By: steven dot mccoy at miru dot hk -Status: Feedback +Status: Open Bug Type: Class/Object related Operating System: Ubuntu 7.04 -PHP Version: 5.2.1 +PHP Version: 5.2.4RC1-dev New Comment:
Reproduced with the Win32 CVS build: PHP 5.2.4RC1-dev (cli) (built: Aug 12 2007 00:04:25) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies Previous Comments: ------------------------------------------------------------------------ [2007-08-11 11:52:08] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows (zip): http://snaps.php.net/win32/php5.2-win32-latest.zip For Windows (installer): http://snaps.php.net/win32/php5.2-win32-installer-latest.msi ------------------------------------------------------------------------ [2007-08-11 06:13:57] steven dot mccoy at miru dot hk Description: ------------ This might be related to bug 41221, upgrading from PHP 5.1.6-1 (Debian) to 5.2.1 (Ubuntu) created a regression in handling output of JSON decoding. Does this mean that I can only use arrays ( json_decode($json, true) ), and have to update all code appropriately? Reproduce code: --------------- <?php $array = array( "first" => array(array("second" => 2), "two", "three"), ); $json = json_encode($array); $obj = json_decode($json); var_dump(array_diff($array,$obj->first)); ?> Expected result: ---------------- array(1) { ["first"]=> array(3) { [0]=> array(1) { ["second"]=> int(2) } [1]=> string(3) "two" [2]=> string(5) "three" } } Actual result: -------------- Catchable fatal error: Object of class stdClass could not be converted to string in /tmp/- on line 7 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42270&edit=1