Merge branch 'PHP-8.1'

* PHP-8.1:
  Fix WeakReference uniquing is TAG_HT is used
This commit is contained in:
Nikita Popov 2021-11-03 10:06:56 +01:00
commit 59d43a4f59
2 changed files with 3 additions and 1 deletions

View file

@ -12,6 +12,7 @@ $map2 = new WeakMap;
$map2[$obj] = 1;
$map3 = clone $map2;
var_dump($ref === WeakReference::create($obj));
var_dump($ref->get(), $map, $map2, $map3);
unset($obj);
var_dump($ref->get(), $map, $map2, $map3);
@ -31,6 +32,7 @@ unset($obj);
?>
--EXPECT--
bool(true)
object(stdClass)#1 (0) {
}
object(WeakMap)#3 (1) {

View file

@ -209,7 +209,7 @@ found_weakref:
}
if (tag == ZEND_WEAKREF_TAG_HT) {
ZEND_HASH_FOREACH(ptr, tagged_ptr) {
ZEND_HASH_FOREACH_PTR(ptr, tagged_ptr) {
if (ZEND_WEAKREF_GET_TAG(tagged_ptr) == ZEND_WEAKREF_TAG_REF) {
ptr = ZEND_WEAKREF_GET_PTR(tagged_ptr);
goto found_weakref;