From: steven dot mccoy at miru dot hk Operating system: Ubuntu PHP version: 5.2.4RC2 PHP Bug Type: Arrays related Bug description: array_diff regression 5.1->5.2 on subobjects
Description: ------------ Upgrading from PHP 5.1.6-1 (Debian) to 5.2.1 (Ubuntu) a regression has appeared in array_diff(). Comparisons now fail when an array member is a stdClass object. Also reproduced with 5.2.4RC1-dev. Reproduce code: --------------- <?php $dogs = array(); $poodle = new stdClass; $poodle->collar = 'red'; array_push($dogs, $poodle); array_push($dogs, 'terrier'); array_push($dogs, 'dalmation'); $cat = array('persian' => array(1, 2, 3)); var_dump(array_diff($dogs, $cat)); ?> Expected result: ---------------- array(3) { [0]=> object(stdClass)#1 (1) { ["collar"]=> string(3) "red" } [1]=> string(7) "terrier" [2]=> string(9) "dalmation" } Actual result: -------------- Catchable fatal error: Object of class stdClass could not be converted to string in /miru/home/steve-o/- on line 11 -- Edit bug report at http://bugs.php.net/?id=42341&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42341&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42341&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42341&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42341&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42341&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42341&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42341&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42341&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42341&r=support Expected behavior: http://bugs.php.net/fix.php?id=42341&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42341&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42341&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42341&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42341&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42341&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42341&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42341&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42341&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42341&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42341&r=mysqlcfg