helly Sun Mar 6 17:57:05 2005 EDT
Modified files:
/php-src/ext/spl spl_iterators.c
Log:
- Fix problem with exceptions in hasChildren calls
http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.c?r1=1.64&r2=1.65&ty=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.64
php-src/ext/spl/spl_iterators.c:1.65
--- php-src/ext/spl/spl_iterators.c:1.64 Tue Mar 1 05:05:12 2005
+++ php-src/ext/spl/spl_iterators.c Sun Mar 6 17:57:05 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_iterators.c,v 1.64 2005/03/01 10:05:12 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.65 2005/03/06 22:57:05 helly Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -166,6 +166,7 @@
zend_class_entry *ce;
zval *retval, *child;
zend_object_iterator *sub_iter;
+ int has_children;
while (1) {
next_step:
@@ -183,9 +184,11 @@
ce = object->iterators[object->level].ce;
zobject =
object->iterators[object->level].zobject;
zend_call_method_with_0_params(&zobject, ce,
NULL, "haschildren", &retval);
- if (zend_is_true(retval)) {
+ if (retval) {
+ has_children = zend_is_true(retval);
zval_ptr_dtor(&retval);
- switch (object->mode) {
+ if (has_children) {
+ switch (object->mode) {
case RIT_LEAVES_ONLY:
case RIT_CHILD_FIRST:
object->iterators[object->level].state = RS_CHILD;
@@ -193,9 +196,9 @@
case RIT_SELF_FIRST:
object->iterators[object->level].state = RS_SELF;
goto next_step;
+ }
}
}
- zval_ptr_dtor(&retval);
object->iterators[object->level].state =
RS_NEXT;
return /* self */;
case RS_SELF:
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php