Re: PHP5 - Weird Error - "cannot find element in variable"

From: Date: Wed, 21 Jul 2004 03:55:27 +0000
Subject: Re: PHP5 - Weird Error - "cannot find element in variable"
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-191260@lists.php.net to get a copy of this message
The Object is being created perfectly, I've checked. The collection's Add() method is something like:
Since you know you're adding MyObject objects, first of all check for that:
            public function Add(MyObject $object)
          public function Add($object)
          {
                   $this->arr_objects[intval($object->position)] =
$object;           < THIS LINE IS THE PROBLEM
From the code provided, I don't see an $object->position property. Are you sure it is there and it is an integer? If you are only getting two values in your iterator then this expression might be evaluating a TRUE to a 1 and a FALSE to a 0... and would overwrite those indexes on each Add().
                   $this->count++;
          }


« previous php.general (#191260) next »