]> granicus.if.org Git - php/commitdiff
- Execute both RecursiveIteratorIterator::beginChildren() and endChildren()
authorMarcus Boerger <helly@php.net>
Sat, 14 May 2005 16:40:58 +0000 (16:40 +0000)
committerMarcus Boerger <helly@php.net>
Sat, 14 May 2005 16:40:58 +0000 (16:40 +0000)
  on the same level (while the actual child is available).

ext/spl/internal/recursiveiteratoriterator.inc
ext/spl/spl_iterators.c

index 65f9a20ba9a76ec281c47ddec653090aca1afd70..0e76de21dd6c0e857b48198ff8c8f68155eb3500 100755 (executable)
@@ -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()
index 879d357374b7a807ab5bb6431d45baa8292bada4..d8f672cc369fafabaf7ebb80286a23155a7db92b 100755 (executable)
@@ -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 */
                }