Skip to content

Fix GH-10570: Assertion `(key)->h != 0 && "Hash must be known"' failed. #10572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Zend/tests/gh10570.phpt
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down