From 53eee290b6f5ca531aef19885a392c939013ce36 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 27 Apr 2020 13:17:37 +0200 Subject: Completely remove disabled functions from function table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- tests/basic/bug31875.phpt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/basic/bug31875.phpt b/tests/basic/bug31875.phpt index 65f68b9af3..c8ad25ec9f 100644 --- a/tests/basic/bug31875.phpt +++ b/tests/basic/bug31875.phpt @@ -8,6 +8,8 @@ disable_functions=dl ---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) -- cgit v1.2.1