summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-01-29 09:39:12 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-01-29 09:39:12 +0100
commit34898e97663084c45b71385ef886e830e023da93 (patch)
tree6ff8dfc4d79c3036884618fa27c3473614f4dbf7 /Zend
parentef68cd324923d81565debef8939b015a3f4b8a6f (diff)
downloadphp-git-34898e97663084c45b71385ef886e830e023da93.tar.gz
Make special assert() handling independent of compiler flags
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend_compile.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 46ca21a436..7c02f05e78 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -3630,7 +3630,7 @@ int zend_compile_func_cuf(znode *result, zend_ast_list *args, zend_string *lcnam
}
/* }}} */
-static int zend_compile_assert(znode *result, zend_ast_list *args, zend_string *name, zend_function *fbc) /* {{{ */
+static void zend_compile_assert(znode *result, zend_ast_list *args, zend_string *name, zend_function *fbc) /* {{{ */
{
if (EG(assertions) >= 0) {
znode name_node;
@@ -3673,8 +3673,6 @@ static int zend_compile_assert(znode *result, zend_ast_list *args, zend_string *
result->op_type = IS_CONST;
ZVAL_TRUE(&result->u.constant);
}
-
- return SUCCESS;
}
/* }}} */
@@ -3882,10 +3880,6 @@ int zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_l
return FAILURE;
}
- if (zend_string_equals_literal(lcname, "assert")) {
- return zend_compile_assert(result, args, lcname, fbc);
- }
-
if (CG(compiler_options) & ZEND_COMPILE_NO_BUILTINS) {
return FAILURE;
}
@@ -3988,8 +3982,16 @@ void zend_compile_call(znode *result, zend_ast *ast, uint32_t type) /* {{{ */
zend_op *opline;
lcname = zend_string_tolower(Z_STR_P(name));
-
fbc = zend_hash_find_ptr(CG(function_table), lcname);
+
+ /* Special assert() handling should apply independently of compiler flags. */
+ if (fbc && zend_string_equals_literal(lcname, "assert")) {
+ zend_compile_assert(result, zend_ast_get_list(args_ast), lcname, fbc);
+ zend_string_release(lcname);
+ zval_ptr_dtor(&name_node.u.constant);
+ return;
+ }
+
if (!fbc
|| (fbc->type == ZEND_INTERNAL_FUNCTION && (CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS))
|| (fbc->type == ZEND_USER_FUNCTION && (CG(compiler_options) & ZEND_COMPILE_IGNORE_USER_FUNCTIONS))