Skip to content

Commit 6f14fcc

Browse files
committed
Fix zend_compile
1 parent 9ec0c60 commit 6f14fcc

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
@@ -8157,9 +8157,7 @@ static zend_string *zend_begin_func_decl(znode *result, zend_op_array *op_array,
81578157
"__autoload() is no longer supported, use spl_autoload_register() instead");
81588158
}
81598159

8160-
if (
8161-
zend_string_equals_literal_ci(unqualified_name, "assert")
8162-
) {
8160+
if (zend_string_equals_literal_ci(unqualified_name, "assert")) {
81638161
zend_error(E_COMPILE_ERROR,
81648162
"Defining a custom assert() function is not allowed, "
81658163
"as the function has special semantics");
@@ -9368,6 +9366,11 @@ static void zend_compile_const_decl(zend_ast *ast) /* {{{ */
93689366
value_node.op_type = IS_CONST;
93699367
zend_const_expr_to_zval(value_zv, value_ast_ptr, /* allow_dynamic */ true);
93709368

9369+
if (zend_get_special_const(ZSTR_VAL(unqualified_name), ZSTR_LEN(unqualified_name))) {
9370+
zend_error_noreturn(E_COMPILE_ERROR,
9371+
"Cannot redeclare constant '%s'", ZSTR_VAL(unqualified_name));
9372+
}
9373+
93719374
name = zend_prefix_with_ns(unqualified_name);
93729375
name = zend_new_interned_string(name);
93739376

0 commit comments

Comments
 (0)