From: online at natweiss dot com Operating system: Linux PHP version: 4.3.10 PHP Bug Type: Class/Object related Bug description: Pass object by value then modify initialized sub-object: passes by reference
Description: ------------ See reproduce code. php.ini is stock / no changes. Reproduce code: --------------- <?php // a class that does nothing class something{ function nothing(){ } } // a pass-by-value function that modifies a member's member function pass_by_value($value){ $value->member->val = 1; } // create a something with a member something $object = new something; $object->member = new something; // call nothing, then call pass_by_value and print results $object->member->nothing(); echo "member->val should be empty!\n"; pass_by_value($object); print_r($object); ?> Expected result: ---------------- $object->member should be empty Actual result: -------------- $object->member->val == 1 -- Edit bug report at http://bugs.php.net/?id=33061&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33061&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33061&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33061&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33061&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33061&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33061&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33061&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33061&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33061&r=support Expected behavior: http://bugs.php.net/fix.php?id=33061&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33061&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33061&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33061&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33061&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33061&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33061&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33061&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33061&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33061&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33061&r=mysqlcfg