com php-src: Fixed bug #71153: NEWS ext/spl/spl_array.c e xt/spl/tests/bug71153.phpt

From: Date: Thu, 17 Dec 2015 19:59:57 +0000
Subject: com php-src: Fixed bug #71153: NEWS ext/spl/spl_array.c e xt/spl/tests/bug71153.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-90320@lists.php.net to get a copy of this message
Commit: a3e19527004dc67dfd875e758007b8ae135d4ed1 Author: Nikita Popov <nikic@php.net> Thu, 17 Dec 2015 20:59:57 +0100 Parents: 9e44b6a61e7ca116c3ea6de4080276ef9a650d06 Branches: PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a3e19527004dc67dfd875e758007b8ae135d4ed1 Log: Fixed bug #71153 Bugs: https://bugs.php.net/71153 Changed paths: M NEWS M ext/spl/spl_array.c A ext/spl/tests/bug71153.phpt Diff: diff --git a/NEWS b/NEWS index 86a6345..16a91ab 100644 --- a/NEWS +++ b/NEWS @@ -44,6 +44,8 @@ PHP NEWS - SPL: . Fixed bug #71077 (ReflectionMethod for ArrayObject constructor returns wrong number of parameters). (Laruence) + . Fixed bug #71153 (Performance Degradation in ArrayIterator with large + arrays). (Nikita) 17 Dec 2015, PHP 7.0.1 diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 0329270..31d5bea 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -130,6 +130,10 @@ static zend_always_inline uint32_t *spl_array_get_pos_ptr(HashTable *ht, spl_arr static void spl_array_object_free_storage(zend_object *object) { spl_array_object *intern = spl_array_from_obj(object); + + if (intern->ht_iter != (uint32_t) -1) { + zend_hash_iterator_del(intern->ht_iter); + } zend_object_std_dtor(&intern->std); diff --git a/ext/spl/tests/bug71153.phpt b/ext/spl/tests/bug71153.phpt new file mode 100644 index 0000000..bdd940c --- /dev/null +++ b/ext/spl/tests/bug71153.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #71153: Performance Degradation in ArrayIterator with large arrays +--FILE-- +<?php + +$n = 200000; + +for ($i = 0; $i < $n; ++$i) { + foreach (new ArrayIterator([]) as $v) {} +} + +echo "done\n"; + +?> +--EXPECT-- +done

« previous php.cvs (#90320) next »