@@ -5874,7 +5874,7 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo
58745874}
58755875/* }}} */
58765876
5877- static int zend_begin_func_decl (znode * result , zend_op_array * op_array , zend_ast_decl * decl , zend_bool toplevel ) /* {{{ */
5877+ static void zend_begin_func_decl (znode * result , zend_op_array * op_array , zend_ast_decl * decl , zend_bool toplevel ) /* {{{ */
58785878{
58795879 zend_ast * params_ast = decl -> child [0 ];
58805880 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
59145914 do_bind_function_error (lcname , op_array , 1 );
59155915 }
59165916 zend_string_release_ex (lcname , 0 );
5917- return SUCCESS ;
5917+ return ;
59185918 }
59195919
59205920 key = zend_build_runtime_definition_key (lcname , decl -> lex_pos );
5921+ zend_hash_update_ptr (CG (function_table ), key , op_array );
5922+
59215923 if (op_array -> fn_flags & ZEND_ACC_CLOSURE ) {
59225924 opline = zend_emit_op_tmp (result , ZEND_DECLARE_LAMBDA_FUNCTION , NULL , NULL );
59235925 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
59325934 zend_add_literal_string (& key );
59335935 }
59345936 zend_string_release_ex (lcname , 0 );
5935-
5936- return zend_hash_add_ptr (CG (function_table ), key , op_array ) != NULL ? SUCCESS : FAILURE ;
59375937}
59385938/* }}} */
59395939
@@ -5979,13 +5979,7 @@ void zend_compile_func_decl(znode *result, zend_ast *ast, zend_bool toplevel) /*
59795979 zend_bool has_body = stmt_ast != NULL ;
59805980 zend_begin_method_decl (op_array , decl -> name , has_body );
59815981 } else {
5982- if (zend_begin_func_decl (result , op_array , decl , toplevel ) == FAILURE ) {
5983- /* A function with this RTD key is already registered.
5984- * Fail gracefully by reusing the existing function. */
5985- destroy_op_array (op_array );
5986- return ;
5987- }
5988-
5982+ zend_begin_func_decl (result , op_array , decl , toplevel );
59895983 if (decl -> kind == ZEND_AST_ARROW_FUNC ) {
59905984 find_implicit_binds (& info , params_ast , stmt_ast );
59915985 compile_implicit_lexical_binds (& info , result , op_array );
0 commit comments