1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix GH-20073: Assertion failure in WeakMap offset operations on reference

Closes GH-20078.
This commit is contained in:
Niels Dossche
2025-10-06 17:51:23 +02:00
parent 9b20618e1b
commit b16761ec11
3 changed files with 18 additions and 1 deletions

2
NEWS
View File

@@ -4,6 +4,8 @@ PHP NEWS
- Core:
. Fixed bug GH-19934 (CGI with auto_globals_jit=0 causes uouv). (ilutov)
. Fixed bug GH-20073 (Assertion failure in WeakMap offset operations on
reference). (nielsdos)
23 Oct 2025, PHP 8.3.27

View File

@@ -0,0 +1,15 @@
--TEST--
GH-20073 (Assertion failure in WeakMap offset operations on reference)
--FILE--
<?php
$obj = new stdClass;
$map = new WeakMap;
$integer = 1;
$map[$obj] = 0;
$map[$obj] =& $integer;
$integer++;
var_dump($map[$obj], $map->offsetGet($obj));
?>
--EXPECT--
int(2)
int(2)

View File

@@ -702,7 +702,7 @@ ZEND_METHOD(WeakMap, offsetGet)
return;
}
ZVAL_COPY(return_value, zv);
RETURN_COPY_DEREF(zv);
}
ZEND_METHOD(WeakMap, offsetSet)