File tree 3 files changed +22
-0
lines changed
3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,8 @@ PHP NEWS
76
76
(ilutov)
77
77
. Fixed bug GH-16479 (Use-after-free in SplObjectStorage::setInfo()). (ilutov)
78
78
. Fixed bug GH-16478 (Use-after-free in SplFixedArray::unset()). (ilutov)
79
+ . Fixed bug GH-15911 (Infinite recursion in AppendIterator::append()).
80
+ (DanielEScherzer)
79
81
80
82
- Standard:
81
83
. Fixed bug GH-16293 (Failed assertion when throwing in assert() callback with
Original file line number Diff line number Diff line change @@ -2961,6 +2961,11 @@ PHP_METHOD(AppendIterator, append)
2961
2961
2962
2962
SPL_FETCH_AND_CHECK_DUAL_IT (intern , ZEND_THIS );
2963
2963
2964
+ if (Z_OBJ_P (ZEND_THIS ) == Z_OBJ_P (it )) {
2965
+ zend_argument_value_error (1 , "must be different than the iterator being appended to" );
2966
+ RETURN_THROWS ();
2967
+ }
2968
+
2964
2969
if (intern -> u .append .iterator -> funcs -> valid (intern -> u .append .iterator ) == SUCCESS && spl_dual_it_valid (intern ) != SUCCESS ) {
2965
2970
spl_array_iterator_append (& intern -> u .append .zarrayit , it );
2966
2971
intern -> u .append .iterator -> funcs -> move_forward (intern -> u .append .iterator );
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-15911 (Infinite recursion when appending AppendIterator to itself)
3
+ --FILE--
4
+ <?php
5
+
6
+ $ iterator = new \AppendIterator ();
7
+
8
+ $ iterator ->append ($ iterator );
9
+ ?>
10
+ --EXPECTF--
11
+ Fatal error: Uncaught ValueError: AppendIterator::append(): Argument #1 ($iterator) must be different than the iterator being appended to in %s:%d
12
+ Stack trace:
13
+ #0 %s(%d): AppendIterator->append(Object(AppendIterator))
14
+ #1 {main}
15
+ thrown in %s on line %d
You can’t perform that action at this time.
0 commit comments