error message: Nesting level too deep - recursive dependency?

From: Date: Sat, 24 Aug 2002 18:32:50 +0000
Subject: error message: Nesting level too deep - recursive dependency?
Groups: php.general 
Request: Send a blank email to php-general+get-113964@lists.php.net to get a copy of this message
Hi I have problem with this error message. Source code is here (not optimized for speed... ): class ListItem {
     var $prev;
     var $next;
     var $data;
     function ListITem() {
         $this->prev = NULL;
         $this->next = NULL;
         $this->data = NULL;
     }
} class List2 {
     var $first;
     var $last;
     var $current;
     var $length;
     function List2()
     {
         $this->first = NULL;
         $this->last = NULL;
         $this->current = NULL;
         $this->length = 0;
     }
     function Add(&$item)
     {
         if (is_null($this->first)) {
             $item->prev = NULL;
             $item->next = NULL;
             $this->first = &$item;
             $this->last = &$item;
         } else {
             $item->prev = &$this->last;
             $item->next = NULL;
             $item->prev->next = &$item;
             $this->last = &$item;
         }
         $this->length++;
     }
     function &item($index)
     {
         $i = 0;
         if ($index >= 0 && $index <= $this->length) {
             $item = $this->first;
             while ($index - $i > 0) {
                 $item = $item->next;
                 $i++;
             }
         } else $item = NULL;
         return $item;
     }
     function findItem(&$item)
     {
         for ($i = 0;$i < $this->length;$i++) {
             $current = $this->item($i);
            !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            !! Here is a problem                                !!
            !! this comparation produced an error message       !!
            !! "Nesting level too deep - recursive dependency?" !!
            !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
             if($current == $item) return true;
         }
         return false;
     }
} Where is a bug??? -- Ondrej Ivanic (ondrej@kmit.sk)

« previous php.general (#113964) next »