Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7f5c3cd

Browse files
committed
Merge branch 'PHP-8.5'
* PHP-8.5: Fix GH-20073: Assertion failure in WeakMap offset operations on reference
2 parents 779ae6f + 544617a commit 7f5c3cd

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

‎Zend/tests/weakrefs/gh20073.phpt‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
GH-20073 (Assertion failure in WeakMap offset operations on reference)
3+
--FILE--
4+
<?php
5+
$obj = new stdClass;
6+
$map = new WeakMap;
7+
$integer = 1;
8+
$map[$obj] = 0;
9+
$map[$obj] =& $integer;
10+
$integer++;
11+
var_dump($map[$obj], $map->offsetGet($obj));
12+
?>
13+
--EXPECT--
14+
int(2)
15+
int(2)

‎Zend/zend_weakrefs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ ZEND_METHOD(WeakMap, offsetGet)
731731
RETURN_THROWS();
732732
}
733733

734-
ZVAL_COPY(return_value, zv);
734+
RETURN_COPY_DEREF(zv);
735735
}
736736

737737
ZEND_METHOD(WeakMap, offsetSet)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /