ID: 24746 User updated by: tim at sparkart dot com Reported By: tim at sparkart dot com Status: Bogus Bug Type: Reproducible crash Operating System: Linux/FreeBSD PHP Version: 4.3.3RC1 New Comment:
Under Comparing objects in PHP 4 (http://www.php.net/manual/en/language.oop.object-comparison-php4.php) it says: "In PHP 4, objects are compared in a very simple manner, namely: Two object instances are equal if they have the same attributes and values, and are instances of the same class." So wouldn't the expected result of "Same Object" match this description? Previous Comments: ------------------------------------------------------------------------ [2003-07-21 20:41:21] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Your object looks like this: object(a)#1 (1) { ["b"]=> object(b)#2 (1) { ["a"]=> &object(a)#1 (1) { ["b"]=> object(b)#2 (1) { ["a"]=> *RECURSION* } } } } Which should explain the error message you are seeing. ------------------------------------------------------------------------ [2003-07-21 19:56:57] tim at sparkart dot com Description: ------------ The code (attached) produces the following error: Fatal error: Nesting level too deep - recursive dependency? in /home/tim/www/crash2.php on line 15 I started getting this bug with some code we are running and did some google searches and found something on the php-dev list (where the sample code is from) from 9/22/02: http://www.geocrawler.com/archives/3/5/2002/9/50/9731982/ This happens on our Linux and FreeBSD boxes running PHP 4.3.2, 4.3.1, and I just installed the latest CVS version (php4-STABLE-200307212330) and got the same error. For the CVS version I configured using "./configure" and ran it through the command line on a Red Hat 8 box. I saw other mentions of this error floating around but couldn't find anything recent so sorry if this is a repeat. Reproduce code: --------------- <?php class A { var $b; function A() { $this->b =& new B($this); } } class B { var $a; function B(&$a) { $this->a =& $a; } } $one =& new A; $two =& $one; if ($one == $two) { // <-- fatal error here echo "Same object\n"; } else { echo "not the same object\n"; } ?> Expected result: ---------------- Expected it to not give a fatal error. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24746&edit=1