on the same level (while the actual child is available).
return $this->ait[$this->count]->getChildren();
}
- /** Called right after calling getChildren()
+ /** Called right after calling getChildren() and its rewind().
* @since PHP 5.1
*/
function beginChildren()
{
}
- /** Called after current child iterator is invalid
+ /** Called after current child iterator is invalid and right before it
+ * gets destructed.
* @since PHP 5.1
*/
function endChildren()
}
/* no more elements */
if (object->level > 0) {
- iterator->funcs->dtor(iterator TSRMLS_CC);
- zval_ptr_dtor(&object->iterators[object->level].zobject);
- object->level--;
if (object->endChildren) {
zend_call_method_with_0_params(&zthis, object->ce, &object->endChildren, "endchildren", NULL);
}
+ iterator->funcs->dtor(iterator TSRMLS_CC);
+ zval_ptr_dtor(&object->iterators[object->level].zobject);
+ object->level--;
} else {
return; /* done completeley */
}