mirror of
https://github.com/php/php-src.git
synced 2026-04-22 23:48:14 +02:00
Merge branch 'PHP-8.0'
* PHP-8.0: Always remove HT iterators, even for uninit HT
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
HT iterator should be destroyed if array becomes empty during array_splice
|
||||
--FILE--
|
||||
<?php
|
||||
$a=[4];
|
||||
$i = 0;
|
||||
foreach ($a as &$r) {
|
||||
var_dump($r);
|
||||
$a = array_splice($a, 0);
|
||||
if (++$i == 2) break;
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
int(4)
|
||||
int(4)
|
||||
+1
-1
@@ -1655,10 +1655,10 @@ ZEND_API void ZEND_FASTCALL zend_array_destroy(HashTable *ht)
|
||||
} else if (EXPECTED(HT_FLAGS(ht) & HASH_FLAG_UNINITIALIZED)) {
|
||||
goto free_ht;
|
||||
}
|
||||
zend_hash_iterators_remove(ht);
|
||||
SET_INCONSISTENT(HT_DESTROYED);
|
||||
efree(HT_GET_DATA_ADDR(ht));
|
||||
free_ht:
|
||||
zend_hash_iterators_remove(ht);
|
||||
FREE_HASHTABLE(ht);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user