summaryrefslogtreecommitdiff
path: root/ext/spl
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2005-05-14 16:40:58 +0000
committerMarcus Boerger <helly@php.net>2005-05-14 16:40:58 +0000
commit626d781afd9adabd299b0df3d441b8e647d74fa4 (patch)
treef96ba09b57968685ec8f44437cee488821f6e495 /ext/spl
parent416ea7638d757605506b9ae2df69c314c8a54cd6 (diff)
downloadphp-git-626d781afd9adabd299b0df3d441b8e647d74fa4.tar.gz
- Execute both RecursiveIteratorIterator::beginChildren() and endChildren()
on the same level (while the actual child is available).
Diffstat (limited to 'ext/spl')
-rwxr-xr-xext/spl/internal/recursiveiteratoriterator.inc5
-rwxr-xr-xext/spl/spl_iterators.c6
2 files changed, 6 insertions, 5 deletions
diff --git a/ext/spl/internal/recursiveiteratoriterator.inc b/ext/spl/internal/recursiveiteratoriterator.inc
index 65f9a20ba9..0e76de21dd 100755
--- a/ext/spl/internal/recursiveiteratoriterator.inc
+++ b/ext/spl/internal/recursiveiteratoriterator.inc
@@ -164,14 +164,15 @@ class RecursiveIteratorIterator implements OuterIterator
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()
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 879d357374..d8f672cc36 100755
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -251,12 +251,12 @@ next_step:
}
/* 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 */
}