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

From: Date: Tue, 17 Aug 1999 12:24:56 +0000
Subject: PHP 4.0 Bug #2075 Updated: Self referential objects can't have more than two references to themselves
Groups: php.dev 
Request: Send a blank email to php-dev+get-9914@lists.php.net to get a copy of this message
ID: 2075 User Update by: dom@recoil.org Status: Open Bug Type: Other 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 = $next->add(new Test); $next = $next->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 Full Bug description available at: http://bugs.php.net/version4/?id=2075

« previous php.dev (#9914) next »