Bug #79382 [Com]: Fatal error: Cannot redeclare getallheaders() in ...
| From: | bugreports at gmail dot com | Date: | Tue, 17 Mar 2020 12:32:41 +0000 |
| Subject: | Bug #79382 [Com]: Fatal error: Cannot redeclare getallheaders() in ... | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-226133@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
Comment by: bugreports at gmail dot com
Reported by: admin at franceserv dot fr
Summary: Fatal error: Cannot redeclare getallheaders() in ...
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:
> 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
Previous Comments:
------------------------------------------------------------------------
[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';
}
------------------------------------------------------------------------
[2020-03-14 14:14:34] admin at franceserv dot fr
This strange behavior seem to exist since 13 years at least :
https://www.php.net/manual/fr/function.function-exists.php#67947
When a function is disabled, if we check this function with function_exists() it's reply
"don't exist", but if we are trying to declare the function it's reply
"exist already". Funny :)
------------------------------------------------------------------------
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