From: computerlov at yahoo dot com Operating system: windows xp PHP version: 5.2.5 PHP Bug Type: Class/Object related Bug description: array_splice behaves unexpectedly when given an object as the last argument
Description: ------------ when doing something like this: $arrOfObjects = array($obj1, obj2....obj10); $oSomeObject = new CSomeClass(); array_splice($arrOfObjects, 8, 2, $oSomeObject); instead of getting an array of 9 objects, you get an array of 8 objects and all the data members of CSomeClass in the array. it's as if we kind of 'var_dumped' the object into the array instead of copying it to the array. Reproduce code: --------------- class CSomeClass { private $m_var1; private $m_var2; } ... $oSomeClass = new CSomeClass(); .. Do Stuff on $oSomeClass .. $arrObjects = ($obj1, $obj2); array_splice($arrObjects, 1, 1, $oSomeClass); Expected result: ---------------- $arrObjects = {$obj1, $obj2, $oSomeClass} Actual result: -------------- $arrObjects = {$obj1, $obj2, $m_var1, $m_var2} -- Edit bug report at http://bugs.php.net/?id=44485&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44485&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44485&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44485&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44485&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44485&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44485&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=44485&r=needscript Try newer version: http://bugs.php.net/fix.php?id=44485&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44485&r=support Expected behavior: http://bugs.php.net/fix.php?id=44485&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44485&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44485&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44485&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44485&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44485&r=dst IIS Stability: http://bugs.php.net/fix.php?id=44485&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44485&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44485&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44485&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=44485&r=mysqlcfg