Skip to content

Commit 3a602d2

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

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ PHP NEWS
2323
. Fix bug GH-8821 (Improve line numbers for errors in constant expressions).
2424
(ilutov)
2525
. Fix bug GH-10083 (Allow comments between & and parameter). (ilutov)
26+
. Fixed unknown string hash on property fetch with integer constant name.
27+
(nielsdos)
2628

2729
- Date:
2830
. Implement More Appropriate Date/Time Exceptions RFC. (Derick)

Zend/tests/gh10570.phpt

Lines changed: 14 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3038,6 +3038,7 @@ static zend_op *zend_delayed_compile_prop(znode *result, zend_ast *ast, uint32_t
30383038
opline = zend_delayed_emit_op(result, ZEND_FETCH_OBJ_R, &obj_node, &prop_node);
30393039
if (opline->op2_type == IS_CONST) {
30403040
convert_to_string(CT_CONSTANT(opline->op2));
3041+
zend_string_hash_val(Z_STR_P(CT_CONSTANT(opline->op2)));
30413042
opline->extended_value = zend_alloc_cache_slots(3);
30423043
}
30433044

0 commit comments

Comments
 (0)