Skip to content

Commit f886231

Browse files
committed
Fix zend_compile
1 parent ce77cdb commit f886231

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Zend/zend_compile.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8160,9 +8160,7 @@ static zend_string *zend_begin_func_decl(znode *result, zend_op_array *op_array,
81608160
"__autoload() is no longer supported, use spl_autoload_register() instead");
81618161
}
81628162

8163-
if (
8164-
zend_string_equals_literal_ci(unqualified_name, "assert")
8165-
) {
8163+
if (zend_string_equals_literal_ci(unqualified_name, "assert")) {
81668164
zend_error(E_COMPILE_ERROR,
81678165
"Defining a custom assert() function is not allowed, "
81688166
"as the function has special semantics");
@@ -9371,6 +9369,11 @@ static void zend_compile_const_decl(zend_ast *ast) /* {{{ */
93719369
value_node.op_type = IS_CONST;
93729370
zend_const_expr_to_zval(value_zv, value_ast_ptr, /* allow_dynamic */ true);
93739371

9372+
if (zend_get_special_const(ZSTR_VAL(unqualified_name), ZSTR_LEN(unqualified_name))) {
9373+
zend_error_noreturn(E_COMPILE_ERROR,
9374+
"Cannot redeclare constant '%s'", ZSTR_VAL(unqualified_name));
9375+
}
9376+
93749377
name = zend_prefix_with_ns(unqualified_name);
93759378
name = zend_new_interned_string(name);
93769379

0 commit comments

Comments
 (0)