rfc:glob_streamwrapper_support

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:glob_streamwrapper_support [2022/09/19 15:38] timintrfc:glob_streamwrapper_support [2022/10/24 13:50] (current) timint
Line 1: Line 1:
 ====== PHP RFC: StreamWrapper Support for glob() ====== ====== PHP RFC: StreamWrapper Support for glob() ======
 +
   * Version: 1.0   * Version: 1.0
   * Date: 2022-08-15   * Date: 2022-08-15
Line 5: Line 6:
   * Status: Under Discussion   * Status: Under Discussion
   * First Published at: https://wiki.php.net/rfc/glob_streamwrapper_support   * First Published at: https://wiki.php.net/rfc/glob_streamwrapper_support
 +
 +**Status: Aborted**
 +
 +**Comment: This RFC has been aborted as no convenient solution or workaround was found for Alpine platform. / Timmy**
  
 ===== Introduction ===== ===== Introduction =====
Line 24: Line 29:
  
 open_basedir check will be removed from result filtering in favour of the already new implemented one in wrapper's opendir. open_basedir check will be removed from result filtering in favour of the already new implemented one in wrapper's opendir.
 +
 +If a StreamWrapper supports listing contents, it will supported by glob(). There will be edge cases where a streamwrapper is not intended to or does not support listing contents of a resource, e.g. http:, data:, compress.zlib:. These cases are not unique to glob() as the same problemematics applies to scandir(). glob() returns an empty array for invalid paths today and will continue doing so for wrappers that can't be used to return a list of contents.
 +
 +Which streamwrapper that can be used with glob() is not a limitation of glob(), but the streamwrapper itself. PHP's current ftp streamwrapper might not support listing files in a directory, but a 3rd party wrapper for ftp might.
 +
 +A word of advice can be put in the documentation that clearifies how glob() will not work with these edge case wrappers. But again, this applies to the current implementation of scandir() also.
  
 ===== Unaffected PHP Functionality ===== ===== Unaffected PHP Functionality =====
 ''glob()'',  GlobalIterator and %%glob:\\%% for local filesystem will return the same results. ''glob()'',  GlobalIterator and %%glob:\\%% for local filesystem will return the same results.
  
-There will be edge cases where a streamwrapper is not intended to or does not support listing contents of a resource, e.g. http://, data://, compress.zlib://. These cases are not unique to glob() as the same problemematic applies to scandir(). glob() returns an empty array for invalid paths today and I propose we continue doing so for wrappers that can't be used to return a list of contents.+Wrappers not intended to return a list of contents will continue returning an empty array as glob does today. 
 + 
 +Edit (Oct 2): As noted by @bukka; the use of GLOB_ALTDIRFUNC is a non-standard implementation that doesn't seem to be supported on AlpineMeaning streamwrappers for glob() would remain unsupported on Alpine systems unless solved.
  
 ===== Future Scope ===== ===== Future Scope =====
rfc/glob_streamwrapper_support.1663601902.txt.gz · Last modified: 2022/09/19 15:38 by timint