Three elements array: Current value: one. Calling hasMore() : bool(true) Current value: two. Calling hasMore() : bool(true) Current value: three. Calling hasMore() : bool(true) - last row *should* return false.
I see, You mean that the hasMore is being used just to assure the current position is valid. While it should be only used to confirm if there are more elements or not. Right? In the case of foreach, it works because it only increments the pointer after get the element (which is valid), but as a general hasMore() method it is faulty because it returns TRUE at the last element and FALSE only after the cursor has reached the "end+1" position. I agree that it should be modified so isValid() and hasMore() would have diferent meanings (the correct ones). Regards, Marc. >Hi Marc >Please take a look at the thread headed 'Iterator >Class/foreach Logic Flaw?' >- you will find your hasMore() returns TRUE when place on the last element, >but (in the exammple code below), there are only three elements - therefore >when on the third element, hasMore() should return false... >This thread is a different (possible) bug - the foreach() construct silently >stops all php processing when called using a class member as the iterator. > >Regards >Philip __________________________________ Do you Yahoo!? Yahoo! Search - Find what you’re looking for faster http://search.yahoo.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php