Skip to content

Commit 34898e9

Browse files
committed
Make special assert() handling independent of compiler flags
1 parent ef68cd3 commit 34898e9

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

Zend/zend_compile.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3630,7 +3630,7 @@ int zend_compile_func_cuf(znode *result, zend_ast_list *args, zend_string *lcnam
36303630
}
36313631
/* }}} */
36323632

3633-
static int zend_compile_assert(znode *result, zend_ast_list *args, zend_string *name, zend_function *fbc) /* {{{ */
3633+
static void zend_compile_assert(znode *result, zend_ast_list *args, zend_string *name, zend_function *fbc) /* {{{ */
36343634
{
36353635
if (EG(assertions) >= 0) {
36363636
znode name_node;
@@ -3673,8 +3673,6 @@ static int zend_compile_assert(znode *result, zend_ast_list *args, zend_string *
36733673
result->op_type = IS_CONST;
36743674
ZVAL_TRUE(&result->u.constant);
36753675
}
3676-
3677-
return SUCCESS;
36783676
}
36793677
/* }}} */
36803678

@@ -3882,10 +3880,6 @@ int zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_l
38823880
return FAILURE;
38833881
}
38843882

3885-
if (zend_string_equals_literal(lcname, "assert")) {
3886-
return zend_compile_assert(result, args, lcname, fbc);
3887-
}
3888-
38893883
if (CG(compiler_options) & ZEND_COMPILE_NO_BUILTINS) {
38903884
return FAILURE;
38913885
}
@@ -3988,8 +3982,16 @@ void zend_compile_call(znode *result, zend_ast *ast, uint32_t type) /* {{{ */
39883982
zend_op *opline;
39893983

39903984
lcname = zend_string_tolower(Z_STR_P(name));
3991-
39923985
fbc = zend_hash_find_ptr(CG(function_table), lcname);
3986+
3987+
/* Special assert() handling should apply independently of compiler flags. */
3988+
if (fbc && zend_string_equals_literal(lcname, "assert")) {
3989+
zend_compile_assert(result, zend_ast_get_list(args_ast), lcname, fbc);
3990+
zend_string_release(lcname);
3991+
zval_ptr_dtor(&name_node.u.constant);
3992+
return;
3993+
}
3994+
39933995
if (!fbc
39943996
|| (fbc->type == ZEND_INTERNAL_FUNCTION && (CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS))
39953997
|| (fbc->type == ZEND_USER_FUNCTION && (CG(compiler_options) & ZEND_COMPILE_IGNORE_USER_FUNCTIONS))

0 commit comments

Comments
 (0)