Merge branch 'PHP-8.1' into PHP-8.2

* PHP-8.1:
  Fix GH-10570: Assertion `(key)->h != 0 && "Hash must be known"' failed.
This commit is contained in:
Ilija Tovilo 2023-02-24 20:41:40 +01:00
commit 9b10b65e2b
No known key found for this signature in database
GPG key ID: A4F5D403F118200A
3 changed files with 17 additions and 0 deletions

2
NEWS
View file

@ -15,6 +15,8 @@ PHP NEWS
. Fixed language scanner generation build. (Daniel Black) . Fixed language scanner generation build. (Daniel Black)
. Fixed zend_update_static_property() calling zend_update_static_property_ex() . Fixed zend_update_static_property() calling zend_update_static_property_ex()
misleadingly with the wrong return type. (nielsdos) misleadingly with the wrong return type. (nielsdos)
. Fixed unknown string hash on property fetch with integer constant name.
(nielsdos)
- Curl: - Curl:
. Fixed deprecation warning at compile time. (Max Kellermann) . Fixed deprecation warning at compile time. (Max Kellermann)

14
Zend/tests/gh10570.phpt Normal file
View file

@ -0,0 +1,14 @@
--TEST--
GH-10570 (Assertion `(key)->h != 0 && "Hash must be known"' failed.): constant variation
--FILE--
<?php
$a = new stdClass();
for ($i = 0; $i < 2; $i++) {
$a->{90};
$a->{0} = 0;
}
?>
--EXPECTF--
Warning: Undefined property: stdClass::$90 in %s on line %d
Warning: Undefined property: stdClass::$90 in %s on line %d

View file

@ -2931,6 +2931,7 @@ static zend_op *zend_delayed_compile_prop(znode *result, zend_ast *ast, uint32_t
opline = zend_delayed_emit_op(result, ZEND_FETCH_OBJ_R, &obj_node, &prop_node); opline = zend_delayed_emit_op(result, ZEND_FETCH_OBJ_R, &obj_node, &prop_node);
if (opline->op2_type == IS_CONST) { if (opline->op2_type == IS_CONST) {
convert_to_string(CT_CONSTANT(opline->op2)); convert_to_string(CT_CONSTANT(opline->op2));
zend_string_hash_val(Z_STR_P(CT_CONSTANT(opline->op2)));
opline->extended_value = zend_alloc_cache_slots(3); opline->extended_value = zend_alloc_cache_slots(3);
} }