From fd2f588b4528cf64108978ddf60d6c86105cddf7 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sun, 12 Feb 2023 11:54:29 +0100 Subject: [PATCH 1/2] Fix GH-10570: Assertion `(key)->h != 0 && "Hash must be known"' failed. Fixes GH-10570, see GH-10570 for analysis. Co-authored-by: Ilija Tovilo --- Zend/zend_compile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 9ca8c654fc207..0774fb6d19a25 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2924,6 +2924,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); if (opline->op2_type == IS_CONST) { 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); } From 479a4884cb5b2edf3155847a6ef7998a376096c0 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sun, 12 Feb 2023 22:28:13 +0100 Subject: [PATCH 2/2] Add regression test for GH-10570 Co-authored-by: Changochen --- Zend/tests/gh10570.phpt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Zend/tests/gh10570.phpt diff --git a/Zend/tests/gh10570.phpt b/Zend/tests/gh10570.phpt new file mode 100644 index 0000000000000..edd35c1ca30ec --- /dev/null +++ b/Zend/tests/gh10570.phpt @@ -0,0 +1,14 @@ +--TEST-- +GH-10570 (Assertion `(key)->h != 0 && "Hash must be known"' failed.): constant variation +--FILE-- +{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