rfc:linking_in_stream_wrappers

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
Last revisionBoth sides next revision
rfc:linking_in_stream_wrappers [2014/10/25 11:32] – Add use cases #2 and #3 thekidrfc:linking_in_stream_wrappers [2017/09/22 13:28] – external edit 127.0.0.1
Line 3: Line 3:
   * Date: 2014-10-25   * Date: 2014-10-25
   * Author: Timm Friebe, thekid@php.net   * Author: Timm Friebe, thekid@php.net
 +  * Contributor: Frank Kleine, https://github.com/mikey179/
   * Status: Draft   * Status: Draft
   * First Published at: https://wiki.php.net/rfc/linking_in_stream_wrappers   * First Published at: https://wiki.php.net/rfc/linking_in_stream_wrappers
Line 19: Line 20:
 Currently, #2 and #3 are already supported by [[http://php.net/manual/en/streamwrapper.url-stat.php|streamWrapper::url_stat()]]. With this accomplished, frameworks such as [[http://vfs.bovigo.org/|vfsStream]] can support testability of symlinking correctly. Currently, #2 and #3 are already supported by [[http://php.net/manual/en/streamwrapper.url-stat.php|streamWrapper::url_stat()]]. With this accomplished, frameworks such as [[http://vfs.bovigo.org/|vfsStream]] can support testability of symlinking correctly.
  
-Use case #1:+Use case #1 - **new functionality**:
 <PHP>  <PHP> 
 class wrapper { class wrapper {
Line 73: Line 74:
 </PHP> </PHP>
  
-Use case #4:+Use case #4 - **new functionality**:
 <PHP> <PHP>
 class wrapper { class wrapper {
Line 81: Line 82:
    *    *
    * @param  string $link    * @param  string $link
-   * @return string The link target or NULL+   * @return string The link target or FALSE if the does not exist
    */    */
   function url_readlink($link) {   function url_readlink($link) {
Line 87: Line 88:
   }   }
 } }
 +</PHP>
 +
 +  * When url_readlink() returns a string, it will be used as readlink()'s return value.
 +  * When url_readlink() returns FALSE, readlink() quietly returns FALSE
 +  * For all other return values of url_readlink(), a warning is raised and readlink() returns FALSE
 +  * When url_readlink() is not implemented, a warning is raised an readlink() returns FALSE.
 +
 +==== Limitations ====
 +
 +It will not be possible to create links between two different stream wrappers like this: 
 +
 +<PHP>
 +symlink('foo://some/resource', 'bar://another/resource'); // will yield a PHP_WARNING and return false
 </PHP> </PHP>
  
Line 122: Line 136:
 ===== Patches and Tests ===== ===== Patches and Tests =====
 TODO: Implement and submit GitHub pull request. TODO: Implement and submit GitHub pull request.
 +https://github.com/thekid/php-src/compare/rfc/linking_in_stream_wrappers
  
 ===== References ===== ===== References =====
-See http://php.net/manual/en/class.streamwrapper.php +  * http://php.net/manual/en/class.streamwrapper.php 
-See https://github.com/mikey179/vfsStream/wiki/Known-Issues +  * [[https://github.com/mikey179/vfsStream/wiki/Known-Issues|List of known issues in vfsStream]] 
 +  * [[https://github.com/mikey179/vfsStream/tree/linking|vfsStream reference userland implementation]]
rfc/linking_in_stream_wrappers.txt · Last modified: 2021/03/27 14:47 by ilutov