Bug #79382 [PATCH]: Cannot redeclare disabled function
| From: | nikic@php.net | Date: | Mon, 27 Apr 2020 12:13:53 +0000 |
| Subject: | Bug #79382 [PATCH]: Cannot redeclare disabled function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-226796@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79382&edit=1
ID: 79382
Patch added by: nikic@php.net
Reported by: admin at franceserv dot fr
Summary: Cannot redeclare disabled function
Status: Open
Type: Bug
Package: *General Issues
Operating System: Linux
PHP Version: 7.3.15 and 7.4
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: Completely remove disabled functions
On GitHub: https://github.com/php/php-src/pull/5473
Patch: https://github.com/php/php-src/pull/5473.patch
Previous Comments:
------------------------------------------------------------------------
[2020-03-17 12:32:41] bugreports at gmail dot com
> It seems to me that function_exists() should return true,
> even if the function is disabled
only if you provide a dedicated function or trow exceptions when disabled functions are called
because otherwise you can't write any code which handles the situation correctly
------------------------------------------------------------------------
[2020-03-17 12:07:15] cmb@php.net
It seems to me that function_exists() should return true, even if
the function is disabled.
------------------------------------------------------------------------
[2020-03-17 09:16:39] nikic@php.net
This is a pretty interesting case. I'm not sure what the correct behavior for this is.
Should we be allowing redefinition of disabled functions? Might be rather problematic technically.
Things would be a lot clearer here if disabled functions were simply completely removed, rather than
replaced with a dummy implementation.
------------------------------------------------------------------------
[2020-03-14 14:27:14] bugreports at gmail dot com
that would also work better if you don't want a seperated include file which could be thrown
away all togehter after deciding no longer support anything below PHP 7.3
on newer php versions this would also optimized out completly and avoid the issue of that bugreport
as well as the terrible runtime overhead of function_exists()
if(PHP_VERSION_ID < 70300))
{
function getallheaders()
{
}
}
------------------------------------------------------------------------
[2020-03-14 14:22:39] bugreports at gmail dot com
"disable_functions" should throw an exception when a disabled function is called so one
can handle it proper without spread *slow and expensive* function exists into the codebase -
try/catch is much faster in cases where it don't throw
such compat layers defining a function which is part of a newer php release should go into a include
file because code like below would be completly optimized out by opcache given the constant nature
known at "compile time"
if(PHP_VERSION_ID < 70300)
{
require 'php73.inc.php';
}
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=79382
--
Edit this bug report at https://bugs.php.net/bug.php?id=79382&edit=1