Skip to content

Commit 14684af

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
2 parents ab3c94a + 34898e9 commit 14684af

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
@@ -3658,7 +3658,7 @@ int zend_compile_func_cuf(znode *result, zend_ast_list *args, zend_string *lcnam
36583658
}
36593659
/* }}} */
36603660

3661-
static int zend_compile_assert(znode *result, zend_ast_list *args, zend_string *name, zend_function *fbc) /* {{{ */
3661+
static void zend_compile_assert(znode *result, zend_ast_list *args, zend_string *name, zend_function *fbc) /* {{{ */
36623662
{
36633663
if (EG(assertions) >= 0) {
36643664
znode name_node;
@@ -3701,8 +3701,6 @@ static int zend_compile_assert(znode *result, zend_ast_list *args, zend_string *
37013701
result->op_type = IS_CONST;
37023702
ZVAL_TRUE(&result->u.constant);
37033703
}
3704-
3705-
return SUCCESS;
37063704
}
37073705
/* }}} */
37083706

@@ -3909,10 +3907,6 @@ int zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_l
39093907
return FAILURE;
39103908
}
39113909

3912-
if (zend_string_equals_literal(lcname, "assert")) {
3913-
return zend_compile_assert(result, args, lcname, fbc);
3914-
}
3915-
39163910
if (CG(compiler_options) & ZEND_COMPILE_NO_BUILTINS) {
39173911
return FAILURE;
39183912
}
@@ -4015,8 +4009,16 @@ void zend_compile_call(znode *result, zend_ast *ast, uint32_t type) /* {{{ */
40154009
zend_op *opline;
40164010

40174011
lcname = zend_string_tolower(Z_STR_P(name));
4018-
40194012
fbc = zend_hash_find_ptr(CG(function_table), lcname);
4013+
4014+
/* Special assert() handling should apply independently of compiler flags. */
4015+
if (fbc && zend_string_equals_literal(lcname, "assert")) {
4016+
zend_compile_assert(result, zend_ast_get_list(args_ast), lcname, fbc);
4017+
zend_string_release(lcname);
4018+
zval_ptr_dtor(&name_node.u.constant);
4019+
return;
4020+
}
4021+
40204022
if (!fbc
40214023
|| (fbc->type == ZEND_INTERNAL_FUNCTION && (CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS))
40224024
|| (fbc->type == ZEND_USER_FUNCTION && (CG(compiler_options) & ZEND_COMPILE_IGNORE_USER_FUNCTIONS))

0 commit comments

Comments
 (0)