Hello l0t3k, first of all your question does not make any sense to me whatsoever.
Anyway looking at the code you seem to be using a c-level iterator manually instead of using it inside foreach() construct. The first thing i can see is that you use the iterator index while the source code (zend_interface.h) says: ulong index; /* private to fe_reset/fe_fetch opcodes */ Unil now noone tried to emulate this stuff so i am not sure whether this is correct or not. But one thing i can say is that your usage revealed an error in the engien code. Index is incremented to early. Which is fixed by now. The second thing is that you did not use the dtor() handler so you have a memory leak. Otherwise i cannot see anything wrong with your iterator usage. And the more i think over it you are probably right in using that index. To try to answer what i think you want to know: What ever object you use. If it implements Traversable or derived its zend_class_entry has a get_iterator function that gets you access to an iteator struct and the handler table. You should never touch the data member of that iterator struct and the handlers are documented. In your case there is no need to use handler invalidate_current(). hope this helps marcus Wednesday, February 15, 2006, 6:23:44 PM, you wrote: > A quick question about using iterators in C code: > If it sufficient to use the interface gotten from > zend_class_entry->get_iterator to handle userland classes which implement > Iterator ? > The attachment is part of code i'm using to do Unicode based collation. Will > this work for userland iterators as well ? > l0t3k Best regards, Marcus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php