Last active
December 12, 2019 11:42
-
-
Save dstogov/d8663c8b42c5346ca16c086d4b052f8d 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 b6a120c94b..5ba10b794c 100644 | |
--- a/Zend/zend_compile.c | |
+++ b/Zend/zend_compile.c | |
@@ -5917,7 +5917,7 @@ 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); | |
+ key = zend_build_runtime_definition_key(lcname, (unsigned char*)(decl->lex_pos - LANG_SCNG(yy_start))); | |
zend_hash_update_ptr(CG(function_table), key, op_array); | |
if (op_array->fn_flags & ZEND_ACC_CLOSURE) { | |
@@ -6555,7 +6555,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); |
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
<?php | |
$tmp = __DIR__ . "/bug65915.inc.php"; | |
file_put_contents($tmp, '<?php return function(){ return function() {return "a";};};'); | |
$f1 = require $tmp; | |
var_dump($f1()()); | |
//var_dump(opcache_invalidate($tmp, true)); | |
file_put_contents($tmp, '<?php return function(){ return function() {return "b";};};'); | |
$f2 = require $tmp; | |
var_dump($f1()(), $f2()()); | |
@unlink($tmp); | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment