From: wickedfather at hotmail dot com Operating system: All PHP version: 5.1.5CVS PHP Bug Type: Feature/Change Request Bug description: __copy magic method to increase backwards compatibility
Description: ------------ An extra magic method that works in the same was as __clone but is called when an object is assigned in the normal way. Code earlier that php5 could be fixed in one place by adding a single method to a class rather than having to find every $obj1 = $obj2 line in your scripts. Reproduce code: --------------- <?php class MyClass { public function __copy { echo 'I want to return a copy, not a reference, like in olden days'; return clone($this); } } $obj1 = new MyClass; $obj2 = $obj1; ?> -- Edit bug report at http://bugs.php.net/?id=38079&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38079&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38079&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38079&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38079&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38079&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38079&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=38079&r=needscript Try newer version: http://bugs.php.net/fix.php?id=38079&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38079&r=support Expected behavior: http://bugs.php.net/fix.php?id=38079&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38079&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38079&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38079&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38079&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38079&r=dst IIS Stability: http://bugs.php.net/fix.php?id=38079&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38079&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38079&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38079&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=38079&r=mysqlcfg