Req #38022 [Opn->Sus]: glob() problems
| From: | cmb@php.net | Date: | Tue, 14 Sep 2021 14:10:15 +0000 |
| Subject: | Req #38022 [Opn->Sus]: glob() problems | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-236599@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=38022&edit=1
ID: 38022
Updated by: cmb@php.net
Reported by: flconseil at yahoo dot fr
Summary: glob() problems
-Status: Open
+Status: Suspended
Type: Feature/Change Request
Package: Filesystem function related
Operating System: All
PHP Version: 5.1.4
Block user comment: N
Private report: N
New Comment:
Note that on Windows, PHP uses an internal glob implementation[1]
as of PHP 4.3.0, but this doesn't solve all the mentioned issues
either (especially open_basedir does not reliably work), and using
that implementation for other platforms might not provide the full
feature set currently available (e.g. GLOB_ONLYDIR is not
supported by that implementation).
Anyway, it might still make sense to use this implementation for
all platforms, but that requires the RFC process[2]. Anybody is
welcome to pursue it; for the time being, I suspend this ticket.
[1] <https://github.com/php/php-src/blob/php-7.4.23/win32/glob.c>
[2] <https://wiki.php.net/rfc/howto>
Previous Comments:
------------------------------------------------------------------------
[2007-02-27 19:15:04] francois at tekwire dot net
An internal glob() implementation should also provide a flag to exclude hidden files (Unix: starting
with a dot, Windows: hidden).
------------------------------------------------------------------------
[2006-07-06 15:10:29] flconseil at yahoo dot fr
Description:
------------
Today, glob() calls the libc glob() function, with the following problems:
- Possible inconsistencies between implementations (POSIX compliance)
- fnmatch not available outside of Unix : an internal glob() implementation would bring an internal
fnmatch() implementation, which would allow fnmatch() on every platform.
- Important: on most (every ?) Unix systems, glob() is using stat() instead of lstat(). Thus, broken
links are ignored. Inconsistant with a naive 'ls' which lists everything in the directory.
- The current glob() implementation in PHP (ext/standard/dir.c) assumes that all returned matches
are in the same directory, which is wrong. So, the 'safe mode' and
'open_basedir' checks are wrong.
- glob() does not support streams, although most other directory functions support them. It cannot
be done without implementing glob() internally.
- Apart from glob(), the chdir() and getcwd() functions should also support stream-wrapped
directories. It would be easy to implement but it must be synchronized with the support of stream
wrapped paths in the include path.
Reproduce code:
---------------
None
Expected result:
----------------
None
Actual result:
--------------
None
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=38022&edit=1