summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-12-11 14:38:48 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-12-11 14:38:48 +0100
commit502cd7b1f154cd58d53e1a7415b8900e76aa6cea (patch)
treefbb0576065a1aea5f76c4db3e19b1b5ade6b88fe /Zend
parentb55033fa18afd9bb60fc4537270266d808ec0868 (diff)
downloadphp-git-502cd7b1f154cd58d53e1a7415b8900e76aa6cea.tar.gz
Revert "Fixed bug #78903: Conflict in RTD key for closures results in crash"
This reverts commit b55033fa18afd9bb60fc4537270266d808ec0868. This breaks ext/opcache/tests/bug65915.phpt.
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend_compile.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 47ed1608ba..b6a120c94b 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -5874,7 +5874,7 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo
}
/* }}} */
-static int zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_ast_decl *decl, zend_bool toplevel) /* {{{ */
+static void zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_ast_decl *decl, zend_bool toplevel) /* {{{ */
{
zend_ast *params_ast = decl->child[0];
zend_string *unqualified_name, *name, *lcname, *key;
@@ -5914,10 +5914,12 @@ static int zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_ast
do_bind_function_error(lcname, op_array, 1);
}
zend_string_release_ex(lcname, 0);
- return SUCCESS;
+ return;
}
key = zend_build_runtime_definition_key(lcname, decl->lex_pos);
+ zend_hash_update_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);
opline->extended_value = zend_alloc_cache_slot();
@@ -5932,8 +5934,6 @@ static int zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_ast
zend_add_literal_string(&key);
}
zend_string_release_ex(lcname, 0);
-
- return zend_hash_add_ptr(CG(function_table), key, op_array) != NULL ? SUCCESS : FAILURE;
}
/* }}} */
@@ -5979,13 +5979,7 @@ void zend_compile_func_decl(znode *result, zend_ast *ast, zend_bool toplevel) /*
zend_bool has_body = stmt_ast != NULL;
zend_begin_method_decl(op_array, decl->name, has_body);
} else {
- if (zend_begin_func_decl(result, op_array, decl, toplevel) == FAILURE) {
- /* A function with this RTD key is already registered.
- * Fail gracefully by reusing the existing function. */
- destroy_op_array(op_array);
- return;
- }
-
+ zend_begin_func_decl(result, op_array, decl, toplevel);
if (decl->kind == ZEND_AST_ARROW_FUNC) {
find_implicit_binds(&info, params_ast, stmt_ast);
compile_implicit_lexical_binds(&info, result, op_array);