Created
December 12, 2019 12:23
-
-
Save dstogov/e2f5806a5f4b4d877e787c94e8c686cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c | |
index 8feb13955d..f3931c1a90 100644 | |
--- a/Zend/zend_compile.c | |
+++ b/Zend/zend_compile.c | |
@@ -5924,8 +5924,15 @@ static void zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_as | |
return; | |
} | |
- key = zend_build_runtime_definition_key(lcname, decl->lex_pos); | |
- zend_hash_update_ptr(CG(function_table), key, op_array); | |
+ key = zend_build_runtime_definition_key(lcname, (unsigned char*)(decl->lex_pos - LANG_SCNG(yy_start))); | |
+ if (UNEXPECTED(!zend_hash_add_ptr(CG(function_table), key, op_array))) { | |
+ zval *zv = zend_hash_find(CG(function_table), key); | |
+ zend_string *new_key = zend_build_runtime_definition_key(lcname, (unsigned char*)Z_PTR_P(zv)); | |
+ | |
+ zend_hash_set_bucket_key(EG(function_table), (Bucket*)zv, new_key); | |
+ zend_string_release(new_key); | |
+ zend_hash_add_new_ptr(CG(function_table), key, op_array); | |
+ } | |
if (op_array->fn_flags & ZEND_ACC_CLOSURE) { | |
opline = zend_emit_op_tmp(result, ZEND_DECLARE_LAMBDA_FUNCTION, NULL, NULL); | |
@@ -6562,7 +6569,7 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */ | |
return opline; | |
} | |
} else { | |
- zend_string *key = zend_build_runtime_definition_key(lcname, decl->lex_pos); | |
+ zend_string *key = zend_build_runtime_definition_key(lcname, (unsigned char*)(decl->lex_pos - LANG_SCNG(yy_start))); | |
/* RTD key is placed after lcname literal in op1 */ | |
zend_add_literal_string(&key); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment