rfc:glob_streamwrapper_support

This is an old revision of the document!


PHP RFC: StreamWrapper Support for glob()

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

  1. the version(s) it was merged into
  2. a link to the git commit(s)
  3. a link to the PHP manual entry for the feature
  4. a link to the language specification section (if any)

References

Github Feature Request #9224

rfc/glob_streamwrapper_support.1660588892.txt.gz · Last modified: 2022/08/15 18:41 by timint