This is an old revision of the document!
PHP RFC: StreamWrapper Support for glob()
- Version: 1.0
- Date: 2022-08-15
- Author: Timmy Almroth, timmy.almroth@gmail.com
- Status: Draft
- First Published at: https://wiki.php.net/rfc/glob_streamwrapper_support
Introduction
The current implementation of glob() is a thin wrapper for POSIX glob(3). Apart from PHP's other Filesystem Functions it is missing support for StreamWrappers.
Workarounds can be a struggle. Some projects may rely on regular expressions which are different from globbing. Some may attempt the use of fnmatch() which does not support all the features of glob() like brace expansions.
Proposal
Consistently implement StreamWrapper support for glob(). Example:
glob('vfs://*.ext')
Backward Incompatible Changes
No backwards incompatibility
Proposed PHP Version(s)
Next PHP 8.x
RFC Impact
No noted impacts as glob() will continue working as before, apart from the new StreamWrapper support. Performance tests so far have shown no anomalies.
Unaffected PHP Functionality
Local file system operations i.e. glob('*.ext') would not be affected by this addition.
Future Scope
There has been some ideas about the future of PHP glob() and the maintained win32 implementation. Whether it could be replaced by a unified standalone implementation, rather than a POSIX layer for the local file system and a separate win32 implementation.
Proposed Voting Choices
Should we implement StreamWrapper support for PHP glob()?
Patches and Tests
Patches and tests are being produced in the Github Feature Request #9224. Final patch will be produced by Github user @KapitanOczywisty.
Implementation
After the project is implemented, this section will contain
- the version(s) it was merged into
- a link to the git commit(s)
- a link to the PHP manual entry for the feature
- a link to the language specification section (if any)
References
Github Feature Request #9224