Bug #18014: Pointers idea in OOP if PHP not consitent

From: Date: Thu, 27 Jun 2002 10:06:51 +0000
Subject: Bug #18014: Pointers idea in OOP if PHP not consitent
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-12221@lists.php.net to get a copy of this message
From: davidktw@singnet.com.sg Operating system: Windows 2000 Pro PHP version: 4.2.1 PHP Bug Type: Class/Object related Bug description: Pointers idea in OOP if PHP not consitent class Node { var $name; var $next; function Node($name) { $this->name = $name; $this->next = NULL; } function getNext() { return $this->next; } function setNext($next) { $this->next = $next; } } $head = new Node("david"); $curr = $head; $curr->setNext(new Node("peter")); $curr = $curr->getNext(); $curr->setNext(new Node("john")); $curr = $head; while ($curr) { print("<p>".$curr->name."</p>"); $curr = $curr->getNext(); } The problem with the code above is.. only "david" is printed.. why isn't the rest of the Nodes printed ? I have checked the linkage If seems like $curr->next is NULL instead of the next Node in the linkedlist... What have I did wrongly ? -- Edit bug report at http://bugs.php.net/?id=18014&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=18014&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=18014&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=18014&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=18014&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=18014&r=support Expected behavior: http://bugs.php.net/fix.php?id=18014&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=18014&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=18014&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=18014&r=globals

« previous php.bugs (#12221) next »