File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #79792: HT iterators not removed if empty array is destroyed
3
+ --FILE--
4
+ <?php
5
+ $ a = [42 ];
6
+ foreach ($ a as &$ c ) {
7
+ // Make the array empty.
8
+ unset($ a [0 ]);
9
+ // Destroy the array.
10
+ $ a = null ;
11
+ }
12
+ ?>
13
+ ===DONE===
14
+ --EXPECTF--
15
+ Warning: foreach() argument must be of type array|object, null given in %s on line %d
16
+ ===DONE===
Original file line number Diff line number Diff line change @@ -1652,11 +1652,11 @@ ZEND_API void ZEND_FASTCALL zend_array_destroy(HashTable *ht)
1652
1652
}
1653
1653
} while (++ p != end );
1654
1654
}
1655
- zend_hash_iterators_remove (ht );
1656
- SET_INCONSISTENT (HT_DESTROYED );
1657
1655
} else if (EXPECTED (HT_FLAGS (ht ) & HASH_FLAG_UNINITIALIZED )) {
1658
1656
goto free_ht ;
1659
1657
}
1658
+ zend_hash_iterators_remove (ht );
1659
+ SET_INCONSISTENT (HT_DESTROYED );
1660
1660
efree (HT_GET_DATA_ADDR (ht ));
1661
1661
free_ht :
1662
1662
FREE_HASHTABLE (ht );
You can’t perform that action at this time.
0 commit comments