ID: 8661 Updated by: jmoore Reported By: [EMAIL PROTECTED] Status: Duplicate Bug Type: Scripting Engine problem PHP Version: 4.0.4 Assigned To: Comments: dup of 8130 Previous Comments: --------------------------------------------------------------------------- [2001-04-28 15:29:23] [EMAIL PROTECTED] dup of 8130 --------------------------------------------------------------------------- [2001-03-16 03:58:55] [EMAIL PROTECTED] I don't agree with this. The zend engine only does a shallow copy in this particular instance, and it is a bug. If the array is not accessed through a method in the object, the copy is performed correctly. Please re-analyze this. --------------------------------------------------------------------------- [2001-03-15 09:20:44] [EMAIL PROTECTED] Zend copies arrays and objects "shallow" (for performance reasons). The workaround is to implement "clone" method. This probably should be built-in function in Zend. --------------------------------------------------------------------------- [2001-02-28 00:21:05] [EMAIL PROTECTED] My bad, my email address is [EMAIL PROTECTED] Please detail on a fix for this bug. Thanks, Larry --------------------------------------------------------------------------- [2001-01-11 16:55:42] [EMAIL PROTECTED] The workaround that I have had to implement is doing an explicit clone method (similar to a copy constructor) and when making a copy, say $new = $old->clone(); instead of $new = $old; example implementation: class Element { var $value; function &clone() { $obj = new Element(); $obj=>value = $this->value; } } class X { var $array; function &clone() { $obj = new X(); foreach($this->array as $index => $value) { $obj->array[$index] = $value->clone(); } return $obj; } } --------------------------------------------------------------------------- The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online. ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=8661&edit=2 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]