Skip to content

Commit 9b10b65

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Fix GH-10570: Assertion `(key)->h != 0 && "Hash must be known"' failed.
2 parents 9cac68d + b9a5bfc commit 9b10b65

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ PHP NEWS
1515
. Fixed language scanner generation build. (Daniel Black)
1616
. Fixed zend_update_static_property() calling zend_update_static_property_ex()
1717
misleadingly with the wrong return type. (nielsdos)
18+
. Fixed unknown string hash on property fetch with integer constant name.
19+
(nielsdos)
1820

1921
- Curl:
2022
. Fixed deprecation warning at compile time. (Max Kellermann)

Zend/tests/gh10570.phpt

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
GH-10570 (Assertion `(key)->h != 0 && "Hash must be known"' failed.): constant variation
3+
--FILE--
4+
<?php
5+
$a = new stdClass();
6+
for ($i = 0; $i < 2; $i++) {
7+
$a->{90};
8+
$a->{0} = 0;
9+
}
10+
?>
11+
--EXPECTF--
12+
Warning: Undefined property: stdClass::$90 in %s on line %d
13+
14+
Warning: Undefined property: stdClass::$90 in %s on line %d

Zend/zend_compile.c

+1
Original file line numberDiff line numberDiff line change
@@ -2931,6 +2931,7 @@ static zend_op *zend_delayed_compile_prop(znode *result, zend_ast *ast, uint32_t
29312931
opline = zend_delayed_emit_op(result, ZEND_FETCH_OBJ_R, &obj_node, &prop_node);
29322932
if (opline->op2_type == IS_CONST) {
29332933
convert_to_string(CT_CONSTANT(opline->op2));
2934+
zend_string_hash_val(Z_STR_P(CT_CONSTANT(opline->op2)));
29342935
opline->extended_value = zend_alloc_cache_slots(3);
29352936
}
29362937

0 commit comments

Comments
 (0)