tony2001 Fri Jul 20 10:53:56 2007 UTC Added files: (Branch: PHP_5_2) /php-src/ext/spl/tests bug41691.phpt
Modified files: /php-src NEWS /php-src/ext/spl spl_array.c Log: MFH: fix #41691 (ArrayObject::exchangeArray hangs Apache) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.841&r2=1.2027.2.547.2.842&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.841 php-src/NEWS:1.2027.2.547.2.842 --- php-src/NEWS:1.2027.2.547.2.841 Thu Jul 19 15:49:44 2007 +++ php-src/NEWS Fri Jul 20 10:53:56 2007 @@ -103,6 +103,7 @@ statements). (Ilia) - Fixed bug #41692 (ArrayObject shows weird behavior in respect to inheritance). (Tony) +- Fixed bug #41691 (ArrayObject::exchangeArray hangs Apache). (Tony) - Fixed bug #41686 (Omitting length param in array_slice not possible). (Ilia) - Fixed bug #41685 (array_push() fails to warn when next index is already http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.12&r2=1.71.2.17.2.13&diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.12 php-src/ext/spl/spl_array.c:1.71.2.17.2.13 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.12 Wed Jun 27 12:30:28 2007 +++ php-src/ext/spl/spl_array.c Fri Jul 20 10:53:56 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.12 2007/06/27 12:30:28 tony2001 Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.13 2007/07/20 10:53:56 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -72,7 +72,7 @@ static inline HashTable *spl_array_get_hash_table(spl_array_object* intern, int check_std_props TSRMLS_DC) { if ((intern->ar_flags & SPL_ARRAY_IS_SELF) != 0) { return intern->std.properties; - } else if ((intern->ar_flags & SPL_ARRAY_USE_OTHER) && (check_std_props == 0 || (intern->ar_flags & SPL_ARRAY_STD_PROP_LIST) == 0)) { + } else if ((intern->ar_flags & SPL_ARRAY_USE_OTHER) && (check_std_props == 0 || (intern->ar_flags & SPL_ARRAY_STD_PROP_LIST) == 0) && Z_TYPE_P(intern->array) == IS_OBJECT) { spl_array_object *other = (spl_array_object*)zend_object_store_get_object(intern->array TSRMLS_CC); return spl_array_get_hash_table(other, check_std_props TSRMLS_CC); } else if ((intern->ar_flags & ((check_std_props ? SPL_ARRAY_STD_PROP_LIST : 0) | SPL_ARRAY_IS_SELF)) != 0) { @@ -1056,6 +1056,7 @@ } zval_ptr_dtor(&intern->array); intern->array = *array; + intern->ar_flags &= ~SPL_ARRAY_USE_OTHER; } if (object == *array) { intern->ar_flags |= SPL_ARRAY_IS_SELF; http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug41691.phpt?view=markup&rev=1.1 Index: php-src/ext/spl/tests/bug41691.phpt +++ php-src/ext/spl/tests/bug41691.phpt --TEST-- Bug #41691 (ArrayObject::exchangeArray hangs Apache) --SKIPIF-- <?php if (!extension_loaded("spl")) print "skip"; ?> --FILE-- <?php class A extends ArrayObject { public function __construct($dummy, $flags) { parent::__construct($this, $flags); } public $a; public $b; public $c; } $a = new A(null, ArrayObject::ARRAY_AS_PROPS ); var_dump($a->exchangeArray(array('a'=>1,'b'=>1,'c'=>1))); echo "Done\n"; ?> --EXPECTF-- array(3) { ["a"]=> NULL ["b"]=> NULL ["c"]=> NULL } Done --UEXPECTF-- array(3) { [u"a"]=> NULL [u"b"]=> NULL [u"c"]=> NULL } Done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php