summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Watkins <krakjoe@php.net>2016-05-04 10:53:59 +0100
committerJoe Watkins <krakjoe@php.net>2016-05-04 10:53:59 +0100
commit9bbee305e3bb1d85ddad6bad92409818953207d5 (patch)
tree6f88259970710b8f9b33d21781f56df1c5582924
parent2d0081cebd131991eea11481c6af3c8965e8364f (diff)
downloadphp-git-9bbee305e3bb1d85ddad6bad92409818953207d5.tar.gz
add compiler option to disable builtins (special case function calls)
-rw-r--r--NEWS1
-rw-r--r--Zend/zend_compile.c10
-rw-r--r--Zend/zend_compile.h3
3 files changed, 12 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 01c9c24601..474445dd73 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ PHP NEWS
?? ??? 2016 PHP 7.0.7
- Core:
+ . Add compiler option to disable special case function calls. (Joe)
. Fixed bug #72101 (crash on complex code). (Dmitry)
. Fixed bug #72100 (implode() inserts garbage into resulting string when
joins very big integer). (Mikhail Galanin)
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index c79f1d75f6..6b78bd8bd5 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -3169,6 +3169,14 @@ 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;
+ }
+
if (zend_string_equals_literal(lcname, "strlen")) {
return zend_compile_func_strlen(result, args);
} else if (zend_string_equals_literal(lcname, "is_null")) {
@@ -3199,8 +3207,6 @@ int zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_l
return zend_compile_func_cufa(result, args, lcname);
} else if (zend_string_equals_literal(lcname, "call_user_func")) {
return zend_compile_func_cuf(result, args, lcname);
- } else if (zend_string_equals_literal(lcname, "assert")) {
- return zend_compile_assert(result, args, lcname, fbc);
} else {
return FAILURE;
}
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index 9e30f55bdc..bbd2df7f2e 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -1011,6 +1011,9 @@ END_EXTERN_C()
/* force IS_OBJ_USE_GUARDS for all classes */
#define ZEND_COMPILE_GUARDS (1<<9)
+/* disable builtin special case function calls */
+#define ZEND_COMPILE_NO_BUILTINS (1<<10)
+
/* The default value for CG(compiler_options) */
#define ZEND_COMPILE_DEFAULT ZEND_COMPILE_HANDLE_OP_ARRAY