diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2017-09-04 21:24:17 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2017-09-04 21:24:32 +0200 |
commit | b2824629c20ef506093303ed6071276561d09bd0 (patch) | |
tree | 83767003b916648a4de945683eb6e7787cef0bc5 | |
parent | 384da65a97f1a2630454a319921cc279c7a286db (diff) | |
parent | c2e3541cc1200f38f72deccac66d889888e3949d (diff) | |
download | php-git-b2824629c20ef506093303ed6071276561d09bd0.tar.gz |
Merge branch 'PHP-7.1' into PHP-7.2
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | ext/spl/spl_iterators.c | 7 | ||||
-rw-r--r-- | ext/spl/tests/bug74977.phpt | 13 | ||||
-rw-r--r-- | ext/spl/tests/bug75155.phpt | 22 |
4 files changed, 27 insertions, 19 deletions
@@ -14,6 +14,10 @@ PHP NEWS - OpenSSL . Automatically load OpenSSL configuration file. (Jakub Zelenka) +- SPL: + . Fixed bug #75155 (AppendIterator::append() is broken when appending another + AppendIterator). (Nikita) + - ZIP: . Fixed bug #75143 (new method setEncryptionName() seems not to exist in ZipArchive). (Anatol) diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index e789a21d41..418543a366 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -3366,7 +3366,7 @@ SPL_METHOD(AppendIterator, __construct) Append an iterator */ SPL_METHOD(AppendIterator, append) { - spl_dual_it_object *intern, *appender; + spl_dual_it_object *intern; zval *it; SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); @@ -3378,11 +3378,6 @@ SPL_METHOD(AppendIterator, append) spl_array_iterator_append(&intern->u.append.zarrayit, it); intern->u.append.iterator->funcs->move_forward(intern->u.append.iterator); }else{ - appender = Z_SPLDUAL_IT_P(it); - if (appender->dit_type == DIT_AppendIterator) { - spl_array_iterator_append(&intern->u.append.zarrayit, &appender->u.append.zarrayit); - return; - } spl_array_iterator_append(&intern->u.append.zarrayit, it); } diff --git a/ext/spl/tests/bug74977.phpt b/ext/spl/tests/bug74977.phpt deleted file mode 100644 index 09e16eedfe..0000000000 --- a/ext/spl/tests/bug74977.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -Bug #74977: Recursion leads to crash ---FILE-- -<?php - -$iterator = new AppendIterator(array("A","A","A")); -$iterator->append($iterator); -var_dump($iterator); -?> ---EXPECTF-- -object(AppendIterator)#1 (0) { -} - diff --git a/ext/spl/tests/bug75155.phpt b/ext/spl/tests/bug75155.phpt new file mode 100644 index 0000000000..0d0c0753e0 --- /dev/null +++ b/ext/spl/tests/bug75155.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #75155: AppendIterator::append() is broken when appending another AppendIterator +--FILE-- +<?php + +$array_a = new ArrayIterator(array('a', 'b', 'c')); +$array_b = new ArrayIterator(array('d', 'e', 'f')); + +$iterator = new AppendIterator; +$iterator->append($array_a); + +$iterator2 = new AppendIterator; +$iterator2->append($iterator); +$iterator2->append($array_b); + +foreach ($iterator2 as $current) { + echo $current; +} + +?> +--EXPECT-- +abcdef |