PHP 4.0 Bug #2075: Self referential objects can't have more than two references to themselves

From: Date: Mon, 16 Aug 1999 20:14:26 +0000
Subject: PHP 4.0 Bug #2075: Self referential objects can't have more than two references to themselves
Groups: php.dev 
Request: Send a blank email to php-dev+get-9894@lists.php.net to get a copy of this message
From: dom@recoil.org Operating system: linux redhat 5.2 PHP version: 4.0 Beta 2 PHP Bug Type: Other Bug description: Self referential objects can't have more than two references to themselves Whenever I try to build a self referential structure, information is lost after two nodes in the chain. The following code shows that the structures can never be more than two nodes deep. <? class Test { var $next; function add($next) { $this->next = $next; return $next; } function dump() { echo "Test!<br>"; $this->next->dump(); } } $test = new Test; $next = $test->add(new Test); $next = $test->add(new Test); $next = $test->add(new Test); $test->dump(); ?> This code causes the following error with both php3 and php4b2: Test! Test! Fatal error: Call to a member function on a non-object in /home/dom/public_html /treetest/test.php3 on line 19 Configure line was: ./configure --with-mysql --with-apache=../apache_1.3.6 --enable-track-vars --with-xml

« previous php.dev (#9894) next »