Skip to content

Commit 231bc7c

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Revert "Fixed bug #78903: Conflict in RTD key for closures results in crash"
2 parents a90abe2 + 502cd7b commit 231bc7c

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

Zend/zend_compile.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6079,7 +6079,7 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo
60796079
}
60806080
/* }}} */
60816081

6082-
static int zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_ast_decl *decl, zend_bool toplevel) /* {{{ */
6082+
static void zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_ast_decl *decl, zend_bool toplevel) /* {{{ */
60836083
{
60846084
zend_string *unqualified_name, *name, *lcname, *key;
60856085
zend_op *opline;
@@ -6114,10 +6114,12 @@ static int zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_ast
61146114
do_bind_function_error(lcname, op_array, 1);
61156115
}
61166116
zend_string_release_ex(lcname, 0);
6117-
return SUCCESS;
6117+
return;
61186118
}
61196119

61206120
key = zend_build_runtime_definition_key(lcname, decl->lex_pos);
6121+
zend_hash_update_ptr(CG(function_table), key, op_array);
6122+
61216123
if (op_array->fn_flags & ZEND_ACC_CLOSURE) {
61226124
opline = zend_emit_op_tmp(result, ZEND_DECLARE_LAMBDA_FUNCTION, NULL, NULL);
61236125
opline->extended_value = zend_alloc_cache_slot();
@@ -6132,8 +6134,6 @@ static int zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_ast
61326134
zend_add_literal_string(&key);
61336135
}
61346136
zend_string_release_ex(lcname, 0);
6135-
6136-
return zend_hash_add_ptr(CG(function_table), key, op_array) != NULL ? SUCCESS : FAILURE;
61376137
}
61386138
/* }}} */
61396139

@@ -6179,13 +6179,7 @@ void zend_compile_func_decl(znode *result, zend_ast *ast, zend_bool toplevel) /*
61796179
zend_bool has_body = stmt_ast != NULL;
61806180
zend_begin_method_decl(op_array, decl->name, has_body);
61816181
} else {
6182-
if (zend_begin_func_decl(result, op_array, decl, toplevel) == FAILURE) {
6183-
/* A function with this RTD key is already registered.
6184-
* Fail gracefully by reusing the existing function. */
6185-
destroy_op_array(op_array);
6186-
return;
6187-
}
6188-
6182+
zend_begin_func_decl(result, op_array, decl, toplevel);
61896183
if (decl->kind == ZEND_AST_ARROW_FUNC) {
61906184
find_implicit_binds(&info, params_ast, stmt_ast);
61916185
compile_implicit_lexical_binds(&info, result, op_array);

0 commit comments

Comments
 (0)