File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ PHP NEWS
17
17
static variable). (Nikita)
18
18
. Fixed bug #79779 (Assertion failure when assigning property of string
19
19
offset by reference). (Nikita)
20
+ . Fixed bug #79792 (HT iterators not removed if empty array is destroyed).
21
+ (Nikita)
20
22
21
23
- Fileinfo:
22
24
. Fixed bug #79756 (finfo_file crash (FILEINFO_MIME)). (cmb)
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: Invalid argument supplied for foreach() in %s on line %d
16
+ ===DONE===
Original file line number Diff line number Diff line change @@ -1627,11 +1627,11 @@ ZEND_API void ZEND_FASTCALL zend_array_destroy(HashTable *ht)
1627
1627
}
1628
1628
} while (++ p != end );
1629
1629
}
1630
- zend_hash_iterators_remove (ht );
1631
- SET_INCONSISTENT (HT_DESTROYED );
1632
1630
} else if (EXPECTED (HT_FLAGS (ht ) & HASH_FLAG_UNINITIALIZED )) {
1633
1631
goto free_ht ;
1634
1632
}
1633
+ zend_hash_iterators_remove (ht );
1634
+ SET_INCONSISTENT (HT_DESTROYED );
1635
1635
efree (HT_GET_DATA_ADDR (ht ));
1636
1636
free_ht :
1637
1637
FREE_HASHTABLE (ht );
You can’t perform that action at this time.
0 commit comments