[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_iterators.c
scottmacSat May 9 19:45:26 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/splspl_iterators.c Log: Fix bug #48206 again http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.28.2.23&r2=1.73.2.30.2.28.2.24&diff_format=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.23 php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.24 --- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.23 Sat May 9 19:35:09 2009 +++ php-src/ext/spl/spl_iterators.c Sat May 9 19:45:26 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.23 2009/05/09 19:35:09 scottmac Exp $ */ +/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.24 2009/05/09 19:45:26 scottmac Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -596,7 +596,9 @@ zval **data; iterator->funcs->get_current_data(iterator, &data TSRMLS_CC); - RETURN_ZVAL(*data, 1, 0); + if (data && *data) { + RETURN_ZVAL(*data, 1, 0); + } } /* }}} */ /* {{{ proto void RecursiveIteratorIterator::next() -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_iterators.c
scottmacSat May 9 19:35:10 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/splspl_iterators.c Log: MFH Fix bug #48206 - Iterating over an invalid data structure leads to a segfault http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.28.2.22&r2=1.73.2.30.2.28.2.23&diff_format=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.22 php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.23 --- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.22 Tue Jan 20 00:43:25 2009 +++ php-src/ext/spl/spl_iterators.c Sat May 9 19:35:09 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.22 2009/01/20 00:43:25 felipe Exp $ */ +/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.23 2009/05/09 19:35:09 scottmac Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -922,7 +922,9 @@ iterator->funcs->get_current_data(iterator, &data TSRMLS_CC); zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling TSRMLS_CC); - RETVAL_ZVAL(*data, 1, 0); + if (data && *data) { + RETVAL_ZVAL(*data, 1, 0); + } if (Z_TYPE_P(return_value) == IS_ARRAY) { zval_dtor(return_value); ZVAL_STRINGL(return_value, "Array", sizeof("Array")-1, 1); @@ -1006,7 +1008,11 @@ zval **data; iterator->funcs->get_current_data(iterator, &data TSRMLS_CC); - RETURN_ZVAL(*data, 1, 0); + if (data && *data) { + RETURN_ZVAL(*data, 1, 0); + } else { + RETURN_NULL(); + } } spl_recursive_tree_iterator_get_prefix(object, &prefix TSRMLS_CC); @@ -2729,7 +2735,9 @@ intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); intern->inner.iterator->funcs->get_current_data(intern->inner.iterator, &data TSRMLS_CC); - RETURN_ZVAL(*data, 1, 0); + if (data && *data) { + RETURN_ZVAL(*data, 1, 0); + } } /* }}} */ /* {{{ proto void NoRewindIterator::next() @@ -3041,6 +3049,9 @@ if (EG(exception)) { return ZEND_HASH_APPLY_STOP; } + if (data == NULL || *data == NULL) { + return ZEND_HASH_APPLY_STOP; + } 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)) { @@ -3072,6 +3083,9 @@ if (EG(exception)) { return ZEND_HASH_APPLY_STOP; } + if (data == NULL || *data == NULL) { + return ZEND_HASH_APPLY_STOP; + } Z_ADDREF_PP(data); add_next_index_zval(return_value, *data); return ZEND_HASH_APPLY_KEEP; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_iterators.c /ext/spl/tests iterator_044.phpt
felipe Tue Jan 20 00:43:25 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/splspl_iterators.c /php-src/ext/spl/tests iterator_044.phpt Log: - MFH: Added missing "return;" http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.28.2.21&r2=1.73.2.30.2.28.2.22&diff_format=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.21 php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.22 --- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.21 Wed Dec 31 11:15:44 2008 +++ php-src/ext/spl/spl_iterators.c Tue Jan 20 00:43:25 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.21 2008/12/31 11:15:44 sebastian Exp $ */ +/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.22 2009/01/20 00:43:25 felipe Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -2360,6 +2360,7 @@ if (!(intern->u.caching.flags & (CIT_CALL_TOSTRING|CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT|CIT_TOSTRING_USE_INNER))) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%s does not fetch string value (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); + return; } if (intern->u.caching.flags & CIT_TOSTRING_USE_KEY) { if (intern->current.key_type == HASH_KEY_IS_STRING) { @@ -2396,6 +2397,7 @@ if (!(intern->u.caching.flags & CIT_FULL_CACHE)){ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%s does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); + return; } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &arKey, &nKeyLength, &value) == FAILURE) { @@ -2420,6 +2422,7 @@ if (!(intern->u.caching.flags & CIT_FULL_CACHE)){ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%s does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); + return; } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arKey, &nKeyLength) == FAILURE) { @@ -2447,6 +2450,7 @@ if (!(intern->u.caching.flags & CIT_FULL_CACHE)){ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%s does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); + return; } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arKey, &nKeyLength) == FAILURE) { @@ -2469,6 +2473,7 @@ if (!(intern->u.caching.flags & CIT_FULL_CACHE)){ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%s does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); + return; } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arKey, &nKeyLength) == FAILURE) { http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_044.phpt?r1=1.1.2.3.2.1&r2=1.1.2.3.2.2&diff_format=u Index: php-src/ext/spl/tests/iterator_044.phpt diff -u php-src/ext/spl/tests/iterator_044.phpt:1.1.2.3.2.1 php-src/ext/spl/tests/iterator_044.phpt:1.1.2.3.2.2 --- php-src/ext/spl/tests/iterator_044.phpt:1.1.2.3.2.1 Sat May 24 14:10:44 2008 +++ php-src/ext/spl/tests/iterator_044.phpt Tue Jan 20 00:43:25 2009 @@ -70,8 +70,6 @@ --EXPECTF-- Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct) - -Notice: Undefined index: 0 in %siterator_044.php on line %d Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct) Warning: CachingIterator::offsetExists() expects exactly 1 parameter, 0 given in %siterator_044.php on line %d -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_iterators.c
felipe Mon Sep 22 13:09:09 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/splspl_iterators.c Log: - MFH: Fixed bug #46088 (RegexIterator::accept - segfault) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.28.2.14&r2=1.73.2.30.2.28.2.15&diff_format=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.14 php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.15 --- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.14 Tue Sep 9 19:44:15 2008 +++ php-src/ext/spl/spl_iterators.c Mon Sep 22 13:09:09 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.14 2008/09/09 19:44:15 lbarnaud Exp $ */ +/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.15 2008/09/22 13:09:09 felipe Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -1689,7 +1689,11 @@ char *subject, tmp[32], *result; intsubject_len, use_copy, count, result_len; zval subject_copy, zcount, *replacement; - + + if (intern->current.data == NULL) { + RETURN_FALSE; + } + if (intern->u.regex.flags & REGIT_USE_KEY) { if (intern->current.key_type == HASH_KEY_IS_LONG) { subject_len = slprintf(tmp, sizeof(tmp), "%ld", intern->current.int_key); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_iterators.c /ext/spl/tests bug46031.phpt
lbarnaudTue Sep 9 19:44:15 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/spl/tests bug46031.phpt Modified files: /php-src/ext/splspl_iterators.c Log: MFH: Fixed bug #46031 (Segfault in AppendIterator::next) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.28.2.13&r2=1.73.2.30.2.28.2.14&diff_format=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.13 php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.14 --- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.13 Fri Aug 8 22:07:07 2008 +++ php-src/ext/spl/spl_iterators.c Tue Sep 9 19:44:15 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.13 2008/08/08 22:07:07 colder Exp $ */ +/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.14 2008/09/09 19:44:15 lbarnaud Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -1445,6 +1445,9 @@ static inline int spl_dual_it_valid(spl_dual_it_object *intern TSRMLS_DC) { + if (!intern->inner.iterator) { + return FAILURE; + } /* FAILURE / SUCCESS */ return intern->inner.iterator->funcs->valid(intern->inner.iterator TSRMLS_CC); } http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug46031.phpt?view=markup&rev=1.1 Index: php-src/ext/spl/tests/bug46031.phpt +++ php-src/ext/spl/tests/bug46031.phpt --TEST-- Bug #46031 (Segfault in AppendIterator::next) --FILE-- next()); ?> --EXPECT-- NULL -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_iterators.c
Hi, was this issue dealt with? regards, Lukas On 30.07.2008, at 02:46, Marcus Boerger wrote: Hello Dmitry, please revert. An array has no natural string representation. So we do want the message here as much as we see it in comparable situations. This is a design decision, I actually played with yout version and did not like it really. marcus Tuesday, July 29, 2008, 1:50:05 PM, you wrote: dmitry Tue Jul 29 11:50:05 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/splspl_iterators.c Log: Removed warning http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.28.2.10&r2=1.73.2.30.2.28.2.11&diff_format=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.10 php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.11 --- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.10 Sat Jul 19 19:45:55 2008 +++ php-src/ext/spl/spl_iterators.c Tue Jul 29 11:50:05 2008 @@ -16,7 +16,7 @@ + --+ */ -/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.10 2008/07/19 19:45:55 colder Exp $ */ +/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.11 2008/07/29 11:50:05 dmitry Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -924,7 +924,12 @@ php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException TSRMLS_CC); RETVAL_ZVAL(*data, 1, 0); - convert_to_string(return_value); + if (Z_TYPE_P(return_value) == IS_ARRAY) { + zval_dtor(return_value); + ZVAL_STRINGL(return_value, "Array", sizeof("Array")-1, 1); + } else { + convert_to_string(return_value); + } php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } Best regards, Marcus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Lukas Kahwe Smith [EMAIL PROTECTED] -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_iterators.c
Hello Dmitry, please revert. An array has no natural string representation. So we do want the message here as much as we see it in comparable situations. This is a design decision, I actually played with yout version and did not like it really. marcus Tuesday, July 29, 2008, 1:50:05 PM, you wrote: > dmitry Tue Jul 29 11:50:05 2008 UTC > Modified files: (Branch: PHP_5_3) > /php-src/ext/splspl_iterators.c > Log: > Removed warning > > > http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.28.2.10&r2=1.73.2.30.2.28.2.11&diff_format=u > Index: php-src/ext/spl/spl_iterators.c > diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.10 > php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.11 > --- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.10 Sat Jul 19 > 19:45:55 2008 > +++ php-src/ext/spl/spl_iterators.c Tue Jul 29 11:50:05 2008 > @@ -16,7 +16,7 @@ > > +--+ > */ > > -/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.10 2008/07/19 19:45:55 colder Exp > $ */ > +/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.11 2008/07/29 11:50:05 dmitry Exp > $ */ > > #ifdef HAVE_CONFIG_H > # include "config.h" > @@ -924,7 +924,12 @@ > > php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException > TSRMLS_CC); > RETVAL_ZVAL(*data, 1, 0); > - convert_to_string(return_value); > + if (Z_TYPE_P(return_value) == IS_ARRAY) { > + zval_dtor(return_value); > + ZVAL_STRINGL(return_value, "Array", sizeof("Array")-1, 1); > + } else { > + convert_to_string(return_value); > + } > php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); > } > Best regards, Marcus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_iterators.c
dmitry Tue Jul 29 11:50:05 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/splspl_iterators.c Log: Removed warning http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.28.2.10&r2=1.73.2.30.2.28.2.11&diff_format=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.10 php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.11 --- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.10 Sat Jul 19 19:45:55 2008 +++ php-src/ext/spl/spl_iterators.c Tue Jul 29 11:50:05 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.10 2008/07/19 19:45:55 colder Exp $ */ +/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.11 2008/07/29 11:50:05 dmitry Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -924,7 +924,12 @@ php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException TSRMLS_CC); RETVAL_ZVAL(*data, 1, 0); - convert_to_string(return_value); + if (Z_TYPE_P(return_value) == IS_ARRAY) { + zval_dtor(return_value); + ZVAL_STRINGL(return_value, "Array", sizeof("Array")-1, 1); + } else { + convert_to_string(return_value); + } php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_iterators.c
colder Sat Jul 19 19:45:55 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/splspl_iterators.c Log: MFH: Complete the ZTS build fix http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.28.2.9&r2=1.73.2.30.2.28.2.10&diff_format=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.9 php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.10 --- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.9 Sat Jul 19 19:24:07 2008 +++ php-src/ext/spl/spl_iterators.c Sat Jul 19 19:45:55 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.9 2008/07/19 19:24:07 derick Exp $ */ +/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.10 2008/07/19 19:45:55 colder Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -538,7 +538,7 @@ Creates a RecursiveIteratorIterator from a RecursiveIterator. */ SPL_METHOD(RecursiveIteratorIterator, __construct) { - spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_RecursiveIteratorIterator, zend_ce_iterator, RIT_RecursiveIteratorIterator TSRMLS_CC); + spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_RecursiveIteratorIterator, zend_ce_iterator, RIT_RecursiveIteratorIterator); } /* }}} */ /* {{{ proto void RecursiveIteratorIterator::rewind() @@ -937,7 +937,7 @@ RecursiveIteratorIterator to generate ASCII graphic trees for the entries in a RecursiveIterator */ SPL_METHOD(RecursiveTreeIterator, __construct) { - spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_RecursiveTreeIterator, zend_ce_iterator, RIT_RecursiveTreeIterator TSRMLS_CC); + spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_RecursiveTreeIterator, zend_ce_iterator, RIT_RecursiveTreeIterator); } /* }}} */ /* {{{ proto void RecursiveTreeIterator::setPrefixPart() throws OutOfRangeException -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_iterators.c
derick Sat Jul 19 19:24:07 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/splspl_iterators.c Log: - MFH: Fixed ZTS build. http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.28.2.8&r2=1.73.2.30.2.28.2.9&diff_format=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.8 php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.9 --- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.8 Sat Jul 19 15:49:21 2008 +++ php-src/ext/spl/spl_iterators.c Sat Jul 19 19:24:07 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.8 2008/07/19 15:49:21 helly Exp $ */ +/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.9 2008/07/19 19:24:07 derick Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -416,7 +416,7 @@ spl_recursive_it_rewind }; -static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *ce_base, zend_class_entry *ce_inner, recursive_it_it_type rit_type TSRMLS_DC) +static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *ce_base, zend_class_entry *ce_inner, recursive_it_it_type rit_type) { zval *object = getThis(); spl_recursive_it_object *intern; @@ -447,7 +447,7 @@ } else { ZVAL_LONG(caching_it_flags, CIT_CATCH_GET_CHILD); } - spl_instantiate_arg_ex2(spl_ce_RecursiveCachingIterator, &caching_it, 1, iterator, caching_it_flags); + spl_instantiate_arg_ex2(spl_ce_RecursiveCachingIterator, &caching_it, 1, iterator, caching_it_flags TSRMLS_CC); zval_ptr_dtor(&caching_it_flags); if (inc_refcount == 0 && iterator) { zval_ptr_dtor(&iterator); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_iterators.c /ext/spl/tests bug41828.phpt
colder Wed Mar 12 13:34:47 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/spl/tests bug41828.phpt Modified files: /php-src/ext/splspl_iterators.c Log: Fix bug #41828 (Fix crash on wrong instantiation) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.28.2.6&r2=1.73.2.30.2.28.2.7&diff_format=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.6 php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.7 --- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.6 Thu Jan 10 10:11:33 2008 +++ php-src/ext/spl/spl_iterators.c Wed Mar 12 13:34:47 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.6 2008/01/10 10:11:33 helly Exp $ */ +/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.7 2008/03/12 13:34:47 colder Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -699,8 +699,13 @@ union _zend_function*function_handler; spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(*object_ptr TSRMLS_CC); long level = object->level; - zval*zobj = object->iterators[level].zobject; - + zval*zobj; + + if (!object->iterators) { + php_error_docref(NULL TSRMLS_CC, E_ERROR, "The %s instance wasn't initialized properly", Z_OBJCE_PP(object_ptr)->name); + } + zobj = object->iterators[level].zobject; + function_handler = std_object_handlers.get_method(object_ptr, method, method_len TSRMLS_CC); if (!function_handler) { if (zend_hash_find(&Z_OBJCE_P(zobj)->function_table, method, method_len+1, (void **) &function_handler) == FAILURE) { http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug41828.phpt?view=markup&rev=1.1 Index: php-src/ext/spl/tests/bug41828.phpt +++ php-src/ext/spl/tests/bug41828.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_iterators.c
helly Thu Jan 10 10:11:33 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/splspl_iterators.c Log: - MFH Fix bug in example code found by Surf Chen http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.28.2.5&r2=1.73.2.30.2.28.2.6&diff_format=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.5 php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.6 --- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.5 Mon Dec 31 07:17:14 2007 +++ php-src/ext/spl/spl_iterators.c Thu Jan 10 10:11:33 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.5 2007/12/31 07:17:14 sebastian Exp $ */ +/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.6 2008/01/10 10:11:33 helly Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -857,6 +857,7 @@ func_params[current] = (zval **) p - (arg_count-current); current++; } + arg_count = current; /* restore */ if (call_user_function_ex(EG(function_table), NULL, &func, &retval_ptr, arg_count, func_params, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) { RETURN_ZVAL(retval_ptr, 0, 1); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_iterators.c /ext/spl/tests bug42703.phpt
helly Thu Oct 18 04:41:39 2007 UTC Added files: (Branch: PHP_5_3) /php-src/ext/spl/tests bug42703.phpt Modified files: /php-src/ext/splspl_iterators.c Log: - Fix #42703 http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.28.2.2&r2=1.73.2.30.2.28.2.3&diff_format=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.2 php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.3 --- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.2 Sun Oct 7 05:22:06 2007 +++ php-src/ext/spl/spl_iterators.c Thu Oct 18 04:41:39 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.2 2007/10/07 05:22:06 davidw Exp $ */ +/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.3 2007/10/18 04:41:39 helly Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -1124,15 +1124,17 @@ spl_dual_it_free(intern TSRMLS_CC); if (!check_more || spl_dual_it_valid(intern TSRMLS_CC) == SUCCESS) { intern->inner.iterator->funcs->get_current_data(intern->inner.iterator, &data TSRMLS_CC); - intern->current.data = *data; - Z_ADDREF_P(intern->current.data); + if (data && *data) { + intern->current.data = *data; + Z_ADDREF_P(intern->current.data); + } if (intern->inner.iterator->funcs->get_current_key) { intern->current.key_type = intern->inner.iterator->funcs->get_current_key(intern->inner.iterator, &intern->current.str_key, &intern->current.str_key_len, &intern->current.int_key TSRMLS_CC); } else { intern->current.key_type = HASH_KEY_IS_LONG; intern->current.int_key = intern->current.pos; } - return SUCCESS; + return EG(exception) ? FAILURE : SUCCESS; } return FAILURE; } http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug42703.phpt?view=markup&rev=1.1 Index: php-src/ext/spl/tests/bug42703.phpt +++ php-src/ext/spl/tests/bug42703.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php