Bug #80914 [Opn->Csd]: function_exists is now case-sensitive for aliases
Edit report at https://bugs.php.net/bug.php?id=80914&edit=1
ID: 80914
Updated by: nikic@php.net
Reported by: chris at vendiadvertising dot com
Summary: function_exists is now case-sensitive for aliases
-Status: Open
+Status: Closed
Type: Bug
Package: *General Issues
Operating System: All
PHP Version: 8.0.3
-Assigned To:
+Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
Closing as https://github.com/php/php-src/pull/6855 has
been merged.
Previous Comments:
------------------------------------------------------------------------
[2021-04-11 19:30:24] rowan dot collins at gmail dot com
The following pull request has been associated:
Patch Name: Remove the "getdir" function which was introduced accidentally
On GitHub: https://github.com/php/php-src/pull/6855
Patch: https://github.com/php/php-src/pull/6855.patch
------------------------------------------------------------------------
[2021-04-11 19:29:35] rowan dot collins at gmail dot com
The problem here is actually not related to case-sensitivity.
The function/alias getdir() didn't exist until PHP 8.0, and it turns out it was actually added
by mistake.
For the full story, see https://externals.io/message/113982 and https://stackoverflow.com/a/66981991/157957
The current plan is to remove it in the next 8.0.x release.
------------------------------------------------------------------------
[2021-04-06 20:10:35] rowan dot collins at gmail dot com
There's actually something a lot weirder going on here.
Firstly, looking closely at the source, it seems that internally, getdir() is the *real* name of the
function, and dir() is the alias.
Secondly, there is no case-sensitivity change, and function_exists() was telling the truth, getdir()
really *didn't* exist on older versions of PHP: https://3v4l.org/dCpeh
It seems that this function had been there for years as some kind of ghost, and a change in PHP 8
brought it to life.
------------------------------------------------------------------------
[2021-03-29 17:54:25] chris at vendiadvertising dot com
I went through all 25 aliases listed in https://github.com/php/php-src/blob/master/ext/standard/basic_functions.stub.php
and it seems that getdir is the only only that is not listed in the PHP docs, so I'm fine
reclassifying this as a documentation update for that specific function.
I do still think, however, with how many aliases exist in PHP that this could still be a problem for
future upgraders.
------------------------------------------------------------------------
[2021-03-29 15:20:33] chris at vendiadvertising dot com
I absolutely agree that writing a function with the same name as a built-in but with different case
is asking for trouble. But is there a list of aliases somewhere to help someone troubleshoot this?
Looking at getdir specifically, searching the manual doesn't provide anything, and it is not
listed as an alias for dir. Maybe this is just a documentation bug then?
------------------------------------------------------------------------
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=80914
--
Edit this bug report at https://bugs.php.net/bug.php?id=80914&edit=1
Thread (8 messages)