mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-7.4'
* PHP-7.4: Fix bug #79603, by retrying on RTD key collision
This commit is contained in:
commit
c2068e95b4
1 changed files with 22 additions and 12 deletions
|
@ -6212,11 +6212,12 @@ static void zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_as
|
|||
return;
|
||||
}
|
||||
|
||||
key = zend_build_runtime_definition_key(lcname, decl->start_lineno);
|
||||
if (!zend_hash_add_ptr(CG(function_table), key, op_array)) {
|
||||
zend_error_noreturn(E_ERROR,
|
||||
"Runtime definition key collision for function %s. This is a bug", ZSTR_VAL(name));
|
||||
}
|
||||
/* Generate RTD keys until we find one that isn't in use yet. */
|
||||
key = NULL;
|
||||
do {
|
||||
zend_tmp_string_release(key);
|
||||
key = zend_build_runtime_definition_key(lcname, decl->start_lineno);
|
||||
} while (!zend_hash_add_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);
|
||||
|
@ -6662,8 +6663,15 @@ void zend_compile_class_decl(znode *result, zend_ast *ast, zend_bool toplevel) /
|
|||
|
||||
zend_register_seen_symbol(lcname, ZEND_SYMBOL_CLASS);
|
||||
} else {
|
||||
name = zend_generate_anon_class_name(decl);
|
||||
lcname = zend_string_tolower(name);
|
||||
/* Find an anon class name that is not in use yet. */
|
||||
name = NULL;
|
||||
lcname = NULL;
|
||||
do {
|
||||
zend_tmp_string_release(name);
|
||||
zend_tmp_string_release(lcname);
|
||||
name = zend_generate_anon_class_name(decl);
|
||||
lcname = zend_string_tolower(name);
|
||||
} while (zend_hash_exists(CG(class_table), lcname));
|
||||
}
|
||||
lcname = zend_new_interned_string(lcname);
|
||||
|
||||
|
@ -6795,18 +6803,20 @@ void zend_compile_class_decl(znode *result, zend_ast *ast, zend_bool toplevel) /
|
|||
opline->extended_value = zend_alloc_cache_slot();
|
||||
zend_make_var_result(result, opline);
|
||||
if (!zend_hash_add_ptr(CG(class_table), lcname, ce)) {
|
||||
/* We checked above that the class name is not used. This really shouldn't happen. */
|
||||
zend_error_noreturn(E_ERROR,
|
||||
"Runtime definition key collision for %s. This is a bug", ZSTR_VAL(name));
|
||||
}
|
||||
} else {
|
||||
zend_string *key = zend_build_runtime_definition_key(lcname, decl->start_lineno);
|
||||
/* Generate RTD keys until we find one that isn't in use yet. */
|
||||
zend_string *key = NULL;
|
||||
do {
|
||||
zend_tmp_string_release(key);
|
||||
key = zend_build_runtime_definition_key(lcname, decl->start_lineno);
|
||||
} while (!zend_hash_add_ptr(CG(class_table), key, ce));
|
||||
|
||||
/* RTD key is placed after lcname literal in op1 */
|
||||
zend_add_literal_string(&key);
|
||||
if (!zend_hash_add_ptr(CG(class_table), key, ce)) {
|
||||
zend_error_noreturn(E_ERROR,
|
||||
"Runtime definition key collision for class %s. This is a bug", ZSTR_VAL(name));
|
||||
}
|
||||
|
||||
opline->opcode = ZEND_DECLARE_CLASS;
|
||||
if (extends_ast && toplevel
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue