]> granicus.if.org Git - php/commitdiff
Completely remove disabled functions from function table
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 27 Apr 2020 11:17:37 +0000 (13:17 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Thu, 30 Apr 2020 07:53:57 +0000 (09:53 +0200)
Currently, disabling a function only replaces the internal
function handler with one that throws a warning, and a few
places in the engine special-case such functions, such as
function_exists. This leaves us with a Schrödinger's function,
which both does not exist (function_exists returns false) and
does exist (you cannot define a function with the same name).
In particular, this prevents the implementation of robust
polyfills, as reported in https://bugs.php.net/bug.php?id=79382:

    if (!function_exists('getallheaders')) {
        function getallheaders(...) { ... }
    }

If getallheaders() is a disabled function, this code will break.

This patch changes disable_functions to remove the functions from
the function table completely. For all intents and purposes, it
will look like the function does not exist.

This also renders two bits of PHP functionality obsolete and thus
deprecated:

 * ReflectionFunction::isDisabled(), as it will no longer be
   possible to construct the ReflectionFunction of a disabled
   function in the first place.
 * get_defined_functions() with $exclude_disabled=false, as
   get_defined_functions() now never returns disabled functions.

Fixed bug #79382.

Closes GH-5473.

22 files changed:
UPGRADING
Zend/tests/bug69315.phpt
Zend/tests/bug79382.phpt [new file with mode: 0644]
Zend/tests/errmsg_020.phpt
Zend/zend_API.c
Zend/zend_API.h
Zend/zend_builtin_functions.c
Zend/zend_builtin_functions.stub.php
Zend/zend_builtin_functions_arginfo.h
Zend/zend_compile.c
ext/opcache/Optimizer/pass1.c
ext/opcache/Optimizer/sccp.c
ext/opcache/Optimizer/zend_func_info.c
ext/opcache/Optimizer/zend_optimizer.c
ext/opcache/Optimizer/zend_optimizer_internal.h
ext/opcache/tests/bug68104.phpt
ext/opcache/tests/bug76796.phpt
ext/reflection/php_reflection.c
ext/reflection/php_reflection.stub.php
ext/reflection/php_reflection_arginfo.h
ext/reflection/tests/ReflectionFunction_isDisabled_basic.phpt
tests/basic/bug31875.phpt

index de376fec44b3b05465459c2c300474fa80b67df6..96b9745d4ce63f6f6c68588121586e5d2ea5a01c 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -178,6 +178,9 @@ PHP 8.0 UPGRADE NOTES
         }
 
     RFC: https://wiki.php.net/rfc/abstract_trait_method_validation
+  . Disabled functions are now treated exactly like non-existent functions.
+    Calling a disabled function will report it as unknown, and redefining a
+    disabled function is now possible.
 
 - COM:
   . Removed the ability to import case-insensitive constants from type
@@ -500,6 +503,11 @@ PHP 8.0 UPGRADE NOTES
 4. Deprecated Functionality
 ========================================
 
+- Core:
+  . Calling get_defined_functions() with $exclude_disabled explicitly set to
+    false is deprecated. get_defined_functions() will never include disabled
+    functions.
+
 - Enchant:
   . enchant_broker_set_dict_path and enchant_broker_get_dict_path
     not available in libenchant < 1.5 nor in libenchant-2
@@ -511,6 +519,11 @@ PHP 8.0 UPGRADE NOTES
     do not accept empty files as valid zip archives any longer.
     Existing workaround will be removed in next version.
 
+- Reflection:
+  . ReflectionFunction::isDisabled() is deprecated, as it is no longer possible
+    to create a ReflectionFunction for a disabled function. This method now
+    always returns false.
+
 ========================================
 5. Changed Functions
 ========================================
index 0eb5afb0808ab0ceba237070abea8d0fa038ff56..82017c055241008cb3a3d208ea7d5f72bdc5b436 100644 (file)
@@ -7,32 +7,44 @@ disable_functions=strlen,defined,call_user_func,constant,is_string
 
 var_dump(function_exists("strlen"));
 var_dump(is_callable("strlen"));
-var_dump(strlen("xxx"));
-var_dump(defined("PHP_VERSION"));
-var_dump(constant("PHP_VERSION"));
-var_dump(call_user_func("strlen"));
-var_dump(is_string("xxx"));
-var_dump(is_string());
+try {
+    var_dump(strlen("xxx"));
+} catch (Error $e) {
+    echo $e->getMessage(), "\n";
+}
+try {
+    var_dump(defined("PHP_VERSION"));
+} catch (Error $e) {
+    echo $e->getMessage(), "\n";
+}
+try {
+    var_dump(constant("PHP_VERSION"));
+} catch (Error $e) {
+    echo $e->getMessage(), "\n";
+}
+try {
+    var_dump(call_user_func("strlen"));
+} catch (Error $e) {
+    echo $e->getMessage(), "\n";
+}
+try {
+    var_dump(is_string("xxx"));
+} catch (Error $e) {
+    echo $e->getMessage(), "\n";
+}
+try {
+    var_dump(is_string());
+} catch (Error $e) {
+    echo $e->getMessage(), "\n";
+}
 
 ?>
---EXPECTF--
+--EXPECT--
 bool(false)
-bool(true)
-
-Warning: strlen() has been disabled for security reasons in %sbug69315.php on line %d
-NULL
-
-Warning: defined() has been disabled for security reasons in %sbug69315.php on line %d
-NULL
-
-Warning: constant() has been disabled for security reasons in %sbug69315.php on line %d
-NULL
-
-Warning: call_user_func() has been disabled for security reasons in %sbug69315.php on line %d
-NULL
-
-Warning: is_string() has been disabled for security reasons in %sbug69315.php on line %d
-NULL
-
-Warning: is_string() has been disabled for security reasons in %s on line %d
-NULL
+bool(false)
+Call to undefined function strlen()
+Call to undefined function defined()
+Call to undefined function constant()
+Call to undefined function call_user_func()
+Call to undefined function is_string()
+Call to undefined function is_string()
diff --git a/Zend/tests/bug79382.phpt b/Zend/tests/bug79382.phpt
new file mode 100644 (file)
index 0000000..bc6099c
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Bug #79382: Cannot redeclare disabled function
+--INI--
+disable_functions=strlen
+--FILE--
+<?php
+
+function strlen(string $x): int {
+    $len = 0;
+    while (isset($x[$len])) $len++;
+    return $len;
+}
+
+var_dump(strlen("foobar"));
+
+?>
+--EXPECT--
+int(6)
index 636e29d01fe31c434dbc84a5f8f5882724019fb8..4a7c326d0531753d84c824f3653da5e468c7eda5 100644 (file)
@@ -5,10 +5,12 @@ disable_functions=phpinfo
 --FILE--
 <?php
 
-phpinfo();
+try {
+    phpinfo();
+} catch (Error $e) {
+    echo $e->getMessage(), "\n";
+}
 
-echo "Done\n";
 ?>
---EXPECTF--
-Warning: phpinfo() has been disabled for security reasons in %s on line %d
-Done
+--EXPECT--
+Call to undefined function phpinfo()
index 37c8820164a5c44505d5abfbfe1bb024a79cc1b4..d2fb08d2d9f2f977803f449fb5ee04660339af57 100644 (file)
@@ -2686,27 +2686,9 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, int name_lengt
 
 /* Disabled functions support */
 
-/* {{{ proto void display_disabled_function(void)
-Dummy function which displays an error when a disabled function is called. */
-ZEND_API ZEND_COLD ZEND_FUNCTION(display_disabled_function)
-{
-       zend_error(E_WARNING, "%s() has been disabled for security reasons", get_active_function_name());
-}
-/* }}} */
-
 ZEND_API int zend_disable_function(char *function_name, size_t function_name_length) /* {{{ */
 {
-       zend_internal_function *func;
-       if ((func = zend_hash_str_find_ptr(CG(function_table), function_name, function_name_length))) {
-               zend_free_internal_arg_info(func);
-           func->fn_flags &= ~(ZEND_ACC_VARIADIC | ZEND_ACC_HAS_TYPE_HINTS | ZEND_ACC_HAS_RETURN_TYPE);
-               func->num_args = 0;
-               func->required_num_args = 0;
-               func->arg_info = NULL;
-               func->handler = ZEND_FN(display_disabled_function);
-               return SUCCESS;
-       }
-       return FAILURE;
+       return zend_hash_str_del(CG(function_table), function_name, function_name_length);
 }
 /* }}} */
 
index 51353ad710c15e7d2d13c657a21608673a6d1c41..fe6ec000e9d081a108a33016a86c4b55786bdceb 100644 (file)
@@ -593,8 +593,6 @@ ZEND_API zend_bool zend_is_iterable(zval *iterable);
 
 ZEND_API zend_bool zend_is_countable(zval *countable);
 
-ZEND_API ZEND_FUNCTION(display_disabled_function);
-
 ZEND_API int zend_get_default_from_internal_arg_info(
                zval *default_value_zval, zend_internal_arg_info *arg_info);
 
index 5682d02822f902091b269950f102a7f1e3301900..300adf400e1d9d6bc0ae197688507ed9a7e34c82 100644 (file)
@@ -1127,7 +1127,7 @@ ZEND_FUNCTION(trait_exists)
 ZEND_FUNCTION(function_exists)
 {
        zend_string *name;
-       zend_function *func;
+       zend_bool exists;
        zend_string *lcname;
 
        ZEND_PARSE_PARAMETERS_START(1, 1)
@@ -1142,15 +1142,10 @@ ZEND_FUNCTION(function_exists)
                lcname = zend_string_tolower(name);
        }
 
-       func = zend_hash_find_ptr(EG(function_table), lcname);
+       exists = zend_hash_exists(EG(function_table), lcname);
        zend_string_release_ex(lcname, 0);
 
-       /*
-        * A bit of a hack, but not a bad one: we see if the handler of the function
-        * is actually one that displays "function is disabled" message.
-        */
-       RETURN_BOOL(func && (func->type != ZEND_INTERNAL_FUNCTION ||
-               func->internal_function.handler != zif_display_disabled_function));
+       RETURN_BOOL(exists);
 }
 /* }}} */
 
@@ -1420,30 +1415,25 @@ ZEND_FUNCTION(get_defined_functions)
        zval internal, user;
        zend_string *key;
        zend_function *func;
-       zend_bool exclude_disabled = 0;
-       char *disable_functions = NULL;
+       zend_bool exclude_disabled = 1;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &exclude_disabled) == FAILURE) {
                RETURN_THROWS();
        }
 
+       if (exclude_disabled == 0) {
+               zend_error(E_DEPRECATED,
+                       "get_defined_functions(): Setting $exclude_disabled to false has no effect");
+       }
+
        array_init(&internal);
        array_init(&user);
        array_init(return_value);
 
-       if (exclude_disabled) {
-               disable_functions = INI_STR("disable_functions");
-       }
        ZEND_HASH_FOREACH_STR_KEY_PTR(EG(function_table), key, func) {
                if (key && ZSTR_VAL(key)[0] != 0) {
                        if (func->type == ZEND_INTERNAL_FUNCTION) {
-                               if (disable_functions != NULL) {
-                                       if (strstr(disable_functions, func->common.function_name->val) == NULL) {
-                                               add_next_index_str(&internal, zend_string_copy(key));
-                                       }
-                               } else {
-                                       add_next_index_str(&internal, zend_string_copy(key));
-                               }
+                               add_next_index_str(&internal, zend_string_copy(key));
                        } else if (func->type == ZEND_USER_FUNCTION) {
                                add_next_index_str(&user, zend_string_copy(key));
                        }
index ec3d5a5203d8ab6aa5202746699ba93dc07b783a..43b55b42a7d3bf18f8332321d256be52b713d414 100644 (file)
@@ -85,7 +85,7 @@ function get_declared_traits(): array {}
 
 function get_declared_interfaces(): array {}
 
-function get_defined_functions(bool $exclude_disabled = false): array {}
+function get_defined_functions(bool $exclude_disabled = true): array {}
 
 function get_defined_vars(): array {}
 
index ab4510f3d8ee5d6ba2cc60b6b241c12ff5737cdd..571b14ba728ffdbcc113a2a286cb513e7a48e584 100644 (file)
@@ -146,7 +146,7 @@ ZEND_END_ARG_INFO()
 #define arginfo_get_declared_interfaces arginfo_func_get_args
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_defined_functions, 0, 0, IS_ARRAY, 0)
-       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, exclude_disabled, _IS_BOOL, 0, "false")
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, exclude_disabled, _IS_BOOL, 0, "true")
 ZEND_END_ARG_INFO()
 
 #define arginfo_get_defined_vars arginfo_func_get_args
index 0923aa71415cdcc229feb05ca31103d8f102491c..bc214fa39aa6bb7dd813477c3c293791e9b07525 100644 (file)
@@ -3934,10 +3934,6 @@ int zend_compile_func_array_slice(znode *result, zend_ast_list *args) /* {{{ */
 
 int zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_list *args, zend_function *fbc, uint32_t type) /* {{{ */
 {
-       if (fbc->internal_function.handler == ZEND_FN(display_disabled_function)) {
-               return FAILURE;
-       }
-
        if (CG(compiler_options) & ZEND_COMPILE_NO_BUILTINS) {
                return FAILURE;
        }
index 9219e5e19e62baabb137e0f5071937cd6c25787e..3beb1788a3e76b4a79cba8ca94b6425a2c011d24 100644 (file)
@@ -382,12 +382,10 @@ constant_binary_op:
                            Z_TYPE(ZEND_OP1_LITERAL(send1_opline)) == IS_STRING) {
                                if ((Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("function_exists")-1 &&
                                        !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
-                                               "function_exists", sizeof("function_exists")-1) &&
-                                       !zend_optimizer_is_disabled_func("function_exists", sizeof("function_exists") - 1)) ||
+                                               "function_exists", sizeof("function_exists")-1)) ||
                                        (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("is_callable")-1 &&
                                        !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
-                                               "is_callable", sizeof("is_callable")) &&
-                                       !zend_optimizer_is_disabled_func("is_callable", sizeof("is_callable") - 1))) {
+                                               "is_callable", sizeof("is_callable")))) {
                                        zend_internal_function *func;
                                        zend_string *lc_name = zend_string_tolower(
                                                        Z_STR(ZEND_OP1_LITERAL(send1_opline)));
@@ -400,12 +398,7 @@ constant_binary_op:
 #endif
                                                ) {
                                                zval t;
-                                               if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("is_callable") - 1 ||
-                                                               func->handler != ZEND_FN(display_disabled_function)) {
-                                                       ZVAL_TRUE(&t);
-                                               } else {
-                                                       ZVAL_FALSE(&t);
-                                               }
+                                               ZVAL_TRUE(&t);
                                                literal_dtor(&ZEND_OP2_LITERAL(init_opline));
                                                MAKE_NOP(init_opline);
                                                literal_dtor(&ZEND_OP1_LITERAL(send1_opline));
@@ -423,8 +416,7 @@ constant_binary_op:
                                        break;
                                } else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("extension_loaded")-1 &&
                                        !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
-                                               "extension_loaded", sizeof("extension_loaded")-1) &&
-                                       !zend_optimizer_is_disabled_func("extension_loaded", sizeof("extension_loaded") - 1)) {
+                                               "extension_loaded", sizeof("extension_loaded")-1)) {
                                        zval t;
                                        zend_string *lc_name = zend_string_tolower(
                                                        Z_STR(ZEND_OP1_LITERAL(send1_opline)));
@@ -465,8 +457,7 @@ constant_binary_op:
                                        break;
                                } else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("constant")-1 &&
                                        !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
-                                               "constant", sizeof("constant")-1) &&
-                                       !zend_optimizer_is_disabled_func("constant", sizeof("constant") - 1)) {
+                                               "constant", sizeof("constant")-1)) {
                                        zval t;
 
                                        if (zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(send1_opline)), &t, 1)) {
@@ -488,7 +479,6 @@ constant_binary_op:
                                } else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("dirname")-1 &&
                                        !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
                                                "dirname", sizeof("dirname") - 1) &&
-                                       !zend_optimizer_is_disabled_func("dirname", sizeof("dirname") - 1) &&
                                        IS_ABSOLUTE_PATH(Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)), Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)))) {
                                        zend_string *dirname = zend_string_init(Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)), Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)), 0);
                                        ZSTR_LEN(dirname) = zend_dirname(ZSTR_VAL(dirname), ZSTR_LEN(dirname));
index d5c27ca664c45edab09f10f29fd5577e81abc04b..adea2187785c638ecc629c8d4cd2e95c382ff372 100644 (file)
@@ -1019,8 +1019,7 @@ static inline int ct_eval_func_call(
        }
 
        func = zend_hash_find_ptr(CG(function_table), name);
-       if (!func || func->type != ZEND_INTERNAL_FUNCTION
-                       || func->internal_function.handler == ZEND_FN(display_disabled_function)) {
+       if (!func || func->type != ZEND_INTERNAL_FUNCTION) {
                return FAILURE;
        }
 
index 6f1c24705171efd4d623398bea4657142ccf86e1..ff29cce9896a8915fea731c1a4e1d42c3a320f54 100644 (file)
@@ -899,9 +899,7 @@ static uint32_t get_internal_func_info(
        }
 
        func_info_t *info = Z_PTR_P(zv);
-       if (UNEXPECTED(zend_optimizer_is_disabled_func(info->name, info->name_len))) {
-               return MAY_BE_NULL;
-       } else if (info->info_func) {
+       if (info->info_func) {
                return info->info_func(call_info, ssa);
        } else {
                return info->info;
index 6f896af27ce41bbacd152dbd049d6ea1943db07a..61d2750ce9f8989a0fe701bae649b9bef1aaff4b 100644 (file)
@@ -157,13 +157,6 @@ static inline int zend_optimizer_add_literal_string(zend_op_array *op_array, zen
        return zend_optimizer_add_literal(op_array, &zv);
 }
 
-int zend_optimizer_is_disabled_func(const char *name, size_t len) {
-       zend_function *fbc = (zend_function *)zend_hash_str_find_ptr(EG(function_table), name, len);
-
-       return (fbc && fbc->type == ZEND_INTERNAL_FUNCTION &&
-                       fbc->internal_function.handler == ZEND_FN(display_disabled_function));
-}
-
 static inline void drop_leading_backslash(zval *val) {
        if (Z_STRVAL_P(val)[0] == '\\') {
                zend_string *str = zend_string_init(Z_STRVAL_P(val) + 1, Z_STRLEN_P(val) - 1, 0);
index ed0dac3e1921dfa29283b40a478dffa6efb944fd..a525b668bfd0ec2ae4883d050d77962f6431478f 100644 (file)
@@ -108,7 +108,6 @@ void zend_optimize_temporary_variables(zend_op_array *op_array, zend_optimizer_c
 void zend_optimizer_nop_removal(zend_op_array *op_array, zend_optimizer_ctx *ctx);
 void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx *ctx);
 void zend_optimizer_compact_vars(zend_op_array *op_array);
-int zend_optimizer_is_disabled_func(const char *name, size_t len);
 zend_function *zend_optimizer_get_called_func(
                zend_script *script, zend_op_array *op_array, zend_op *opline, zend_bool *is_prototype);
 uint32_t zend_optimizer_classify_function(zend_string *name, uint32_t num_args);
index 8d3bf70a4d0693db537adababdae06dbe55e768c..6d994c79afe092e6d18df3cb8c33033f4e8c7198 100644 (file)
@@ -11,9 +11,12 @@ disable_functions=dl
 --FILE--
 <?php
 var_dump(is_callable("dl"));
-dl("a.so");
+try {
+    dl("a.so");
+} catch (Error $e) {
+    echo $e->getMessage(), "\n";
+}
 ?>
---EXPECTF--
-bool(true)
-
-Warning: dl() has been disabled for security reasons in %sbug68104.php on line %d
+--EXPECT--
+bool(false)
+Call to undefined function dl()
index ba7e26a0d5dc3ba873b57763018c5554565b761e..18f25d2558907b3d473ba0afb9dfb496671af924 100644 (file)
@@ -10,9 +10,12 @@ disable_functions=strpos
 --FILE--
 <?php
 
-var_dump(strpos('foo', 'bar'));
+try {
+    var_dump(strpos('foo', 'bar'));
+} catch (Error $e) {
+    echo $e->getMessage(), "\n";
+}
 
 ?>
---EXPECTF--
-Warning: strpos() has been disabled for security reasons in %s on line %d
-NULL
+--EXPECT--
+Call to undefined function strpos()
index 552913dd1ef02460354bfaeb56ee0afa5674405a..2856e0c6db77f3c0b246ae3f7a50f86f64f9d459 100644 (file)
@@ -1549,16 +1549,12 @@ ZEND_METHOD(ReflectionFunctionAbstract, isUserDefined)
    Returns whether this function has been disabled or not */
 ZEND_METHOD(ReflectionFunction, isDisabled)
 {
-       reflection_object *intern;
-       zend_function *fptr;
-
-       GET_REFLECTION_OBJECT_PTR(fptr);
-
        if (zend_parse_parameters_none() == FAILURE) {
                RETURN_THROWS();
        }
 
-       RETURN_BOOL(fptr->type == ZEND_INTERNAL_FUNCTION && fptr->internal_function.handler == zif_display_disabled_function);
+       /* A disabled function cannot be queried using Reflection. */
+       RETURN_FALSE;
 }
 /* }}} */
 
index be6269fe78ba13de6694b866b58c4795e3a79175..0adce7921c57355b5af2b51d8c0e6c0842c23f5a 100644 (file)
@@ -104,7 +104,10 @@ class ReflectionFunction extends ReflectionFunctionAbstract
 
     public function __toString(): string {}
 
-    /** @return bool */
+    /**
+     * @return bool
+     * @deprecated ReflectionFunction can no longer be constructed for disabled functions
+     */
     public function isDisabled() {}
 
     /** @return mixed */
index a0a606295b7ac5b4d0fff632427e91358f7ee6db..a7f12dba8ca1f5c945816744458dbd7f75e464a0 100644 (file)
@@ -694,7 +694,7 @@ static const zend_function_entry class_ReflectionFunctionAbstract_methods[] = {
 static const zend_function_entry class_ReflectionFunction_methods[] = {
        ZEND_ME(ReflectionFunction, __construct, arginfo_class_ReflectionFunction___construct, ZEND_ACC_PUBLIC)
        ZEND_ME(ReflectionFunction, __toString, arginfo_class_ReflectionFunction___toString, ZEND_ACC_PUBLIC)
-       ZEND_ME(ReflectionFunction, isDisabled, arginfo_class_ReflectionFunction_isDisabled, ZEND_ACC_PUBLIC)
+       ZEND_ME(ReflectionFunction, isDisabled, arginfo_class_ReflectionFunction_isDisabled, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED)
        ZEND_ME(ReflectionFunction, invoke, arginfo_class_ReflectionFunction_invoke, ZEND_ACC_PUBLIC)
        ZEND_ME(ReflectionFunction, invokeArgs, arginfo_class_ReflectionFunction_invokeArgs, ZEND_ACC_PUBLIC)
        ZEND_ME(ReflectionFunction, getClosure, arginfo_class_ReflectionFunction_getClosure, ZEND_ACC_PUBLIC)
index 220c16f9cb10ad54dd591ddbd04129579640e49b..d63492751655eeebadb6541138067a0b7698eecf 100644 (file)
@@ -7,8 +7,18 @@ TestFest PHP|Tek
 disable_functions=is_file
 --FILE--
 <?php
-$rc = new ReflectionFunction('is_file');
-var_dump($rc->isDisabled());
+try {
+    $rf = new ReflectionFunction('is_file');
+    var_dump($rf->isDisabled());
+} catch (ReflectionException $e) {
+    echo $e->getMessage(), "\n";
+}
+
+$rf = new ReflectionFunction('is_string');
+var_dump($rf->isDisabled());
 ?>
---EXPECT--
-bool(true)
+--EXPECTF--
+Function is_file() does not exist
+
+Deprecated: Function ReflectionFunction::isDisabled() is deprecated in %s on line %d
+bool(false)
index 65f68b9af3b8ac0d4735ab390530081ad2686fef..c8ad25ec9f62c334ecbedeef7efa4c278c85378e 100644 (file)
@@ -8,6 +8,8 @@ disable_functions=dl
 <?php
 $disabled_function = 'dl';
 
+/* exclude_disabled parameters is harded to true */
+
 $functions = get_defined_functions();
 var_dump(in_array($disabled_function, $functions['internal']));
 
@@ -17,7 +19,9 @@ var_dump(in_array($disabled_function, $functions['internal']));
 $functions = get_defined_functions(true);
 var_dump(in_array($disabled_function, $functions['internal']));
 ?>
---EXPECT--
-bool(true)
-bool(true)
+--EXPECTF--
+bool(false)
+
+Deprecated: get_defined_functions(): Setting $exclude_disabled to false has no effect in %s on line %d
+bool(false)
 bool(false)