ID: 31449 User updated by: marcus at lastcraft dot com Reported By: marcus at lastcraft dot com Status: Assigned Bug Type: Class/Object related Operating System: Linux PHP Version: 5.0.1 Assigned To: andi New Comment:
Hi. The workaround does not work here because the serialize() function is nt canonical. That is two equivalent objects will not come out the same. E.g... serialize(array('a' => 'A', 'b' => 'B')) ...is not the same as... serialize(array('b' => 'B', 'a' => 'A')) An object ID misses the mark. I am trying to compare two different objects for equality, that is the same value. Having unique IDs just ensures they are different objects. I am completely defeated by the Zend engine at this point. I have had to come up with some tortuous workarounds involving dependency injection which I would love to do without. Not least because it causes me to keep references lying around, defeating the PHP garbage collector. Makes any pattern which treats objects as messages rather problematical for example. yours, Marcus Previous Comments: ------------------------------------------------------------------------ [2005-02-11 13:14:25] lsblsb at gmx dot de There is a workaround for this problem: Serialize the references you want to compare, and compare their serialized versions. Or - give your Objects id's and compare their references by their id's. Hope this helps. ------------------------------------------------------------------------ [2005-01-10 21:10:59] [EMAIL PROTECTED] This one is for the Zend mastahs... but I'm not sure if this is very easy to fix. ------------------------------------------------------------------------ [2005-01-10 15:30:11] nospam at nospam dot com C:\downloads\php5.0-win32-latest>php -v PHP 5.0.4-dev (cli) (built: Jan 10 2005 10:20:12) Copyright (c) 1997-2004 The PHP Group Zend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies C:\downloads\php5.0-win32-latest>php recursive.php Fatal error: Nesting level too deep - recursive dependency? in C:\downloads\php5 .0-win32-latest\recursive.php on line 10 C:\downloads\php5.0-win32-latest> ------------------------------------------------------------------------ [2005-01-10 08:14:17] [EMAIL PROTECTED] If you don't want to test the latest version, we can't help. ------------------------------------------------------------------------ [2005-01-10 04:25:49] marcus at lastcraft dot com Hi... Well thanks for the standard response in an attempt to stall. I had enough trouble getting version 5.01 onto my Mandrake 9 box without going through the whole thing again with an experimental version, and then having to uninstall it. It would take several hours (possibly days) out of my time, but for a developer with a CVS snapshot installed it would take seconds. I could hardly have made the code shorter. So in short, no thanks. Unless perhaps you have information that this part of the code base has been worked on with respect to this issue? yours, Marcus ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/31449 -- Edit this bug report at http://bugs.php.net/?id=31449&edit=1