php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #38022 glob() problems
Submitted: 2006-07-06 15:10 UTC Modified: 2016-12-30 23:50 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: flconseil at yahoo dot fr Assigned:
Status: Open Package: Filesystem function related
PHP Version: 5.1.4 OS: All
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-07-06 15:10 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-27 19:15 UTC] 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).
 [2016-12-30 23:50 UTC] cmb@php.net
-Package: Feature/Change Request +Package: Filesystem function related
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC