PHP 8.0: Disabled functions: Reflection and
In PHP 8, disabled functions are not added to PHP's internal functions table. This makes PHP behave as if disabled functions are not defined at all.
Related to this change, there are two new deprecations in PHP 8.
ReflectionFunction::isDisabled() is deprecated
ReflectionFunction::isDisabled() method is deprecated because it no longer provides any useful information to the caller.
Deprecated: Function ReflectionFunction::isDisabled() is deprecated in %s on line %d
This method will always return
false even if the function is disabled with the INI directive.
There is no need to check if a function is disabled because
function_exists() will return
true only if the function is declared and not disabled.
get_defined_functions($exclude_disabled = false) is deprecated
For the same reasons that disabled functions are not included in functions list,
get_defined_functions() function with the first parameter
$exclude_disabled set to
false is disabled.
get_defined_functions() will always exclude disabled functions in PHP 8, and even if you try to get all functions including the excluded ones, it will not return disabled functions.
If you redefine a disabled function, that function will be in the
user key of the
get_defined_functions() return array, even if it is defined internally and disabled via the
disable_functions INI directive.
Backwards compatibility impact
The main use-case for
disable_functions INI directive is to disable potentially unsafe functions such as
system(). The deprecation notices are unlikely to occur, but it does not introduce any loss of functionality.
A fuzzy GitHub code search does not yield any uses this pattern.