We need to remove the iterators even if the array is empty (we
will not create one if the first place, but the array may become
empty after the fact).
- Core:
. Fixed bug #79778 (Assertion failure if dumping closure with unresolved
static variable). (Nikita)
+ . Fixed bug #79792 (HT iterators not removed if empty array is destroyed).
+ (Nikita)
- COM:
. Fixed bug #63208 (BSTR to PHP string conversion not binary safe). (cmb)
--- /dev/null
+--TEST--
+Bug #79792: HT iterators not removed if empty array is destroyed
+--FILE--
+<?php
+$a = [42];
+foreach ($a as &$c) {
+ // Make the array empty.
+ unset($a[0]);
+ // Destroy the array.
+ $a = null;
+}
+?>
+===DONE===
+--EXPECTF--
+Warning: Invalid argument supplied for foreach() in %s on line %d
+===DONE===
}
} while (++p != end);
}
- zend_hash_iterators_remove(ht);
- SET_INCONSISTENT(HT_DESTROYED);
} else if (EXPECTED(!(HT_FLAGS(ht) & HASH_FLAG_INITIALIZED))) {
goto free_ht;
}
+ zend_hash_iterators_remove(ht);
+ SET_INCONSISTENT(HT_DESTROYED);
efree(HT_GET_DATA_ADDR(ht));
free_ht:
FREE_HASHTABLE(ht);