tony2001 Fri May 12 09:42:19 2006 UTC Modified files: /php-src/ext/spl spl_iterators.c Log: fix #37416 (iterator_to_array() hides exceptions thrown in rewind() method) http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_iterators.c?r1=1.125&r2=1.126&diff_format=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.125 php-src/ext/spl/spl_iterators.c:1.126 --- php-src/ext/spl/spl_iterators.c:1.125 Wed May 10 16:51:18 2006 +++ php-src/ext/spl/spl_iterators.c Fri May 12 09:42:19 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_iterators.c,v 1.125 2006/05/10 16:51:18 andrei Exp $ */ +/* $Id: spl_iterators.c,v 1.126 2006/05/12 09:42:19 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -2400,11 +2400,20 @@ if (iter->funcs->rewind) { iter->funcs->rewind(iter TSRMLS_CC); } + if (EG(exception)) { + return; + } while (iter->funcs->valid(iter TSRMLS_CC) == SUCCESS) { iter->funcs->get_current_data(iter, &data TSRMLS_CC); + if (EG(exception)) { + return; + } (*data)->refcount++; if (iter->funcs->get_current_key) { key_type = iter->funcs->get_current_key(iter, &str_key, &str_key_len, &int_key TSRMLS_CC); + if (EG(exception)) { + return; + } switch(key_type) { case HASH_KEY_IS_STRING: add_assoc_zval_ex(return_value, str_key.s, str_key_len, *data); @@ -2422,8 +2431,14 @@ add_next_index_zval(return_value, *data); } iter->funcs->move_forward(iter TSRMLS_CC); + if (EG(exception)) { + return; + } } iter->funcs->dtor(iter TSRMLS_CC); + if (EG(exception)) { + return; + } } /* }}} */ @@ -2444,11 +2459,23 @@ if (iter->funcs->rewind) { iter->funcs->rewind(iter TSRMLS_CC); } + if (EG(exception)) { + return; + } while (iter->funcs->valid(iter TSRMLS_CC) == SUCCESS) { + if (EG(exception)) { + return; + } count++; iter->funcs->move_forward(iter TSRMLS_CC); + if (EG(exception)) { + return; + } } iter->funcs->dtor(iter TSRMLS_CC); + if (EG(exception)) { + return; + } RETURN_LONG(count); }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php