]> granicus.if.org Git - php/commitdiff
add compiler option to disable builtins (special case function calls)
authorJoe Watkins <krakjoe@php.net>
Wed, 4 May 2016 09:53:59 +0000 (10:53 +0100)
committerJoe Watkins <krakjoe@php.net>
Wed, 4 May 2016 09:53:59 +0000 (10:53 +0100)
NEWS
Zend/zend_compile.c
Zend/zend_compile.h

diff --git a/NEWS b/NEWS
index 01c9c2460112215c1f880f009d64b568b6399707..474445dd73933f7fcd0a634fb57cc2fe4ac512ac 100644 (file)
--- 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)
index c79f1d75f69aa7859ff76410cc489fd4494d3b74..6b78bd8bd5b3b3c95ff098e68b79014df2aa4bb2 100644 (file)
@@ -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;
        }
index 9e30f55bdc329b70c7567e270f9eafaa1041a54e..bbd2df7f2e8839bd447100bb919e720d34e44cfd 100644 (file)
@@ -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