rfc:linking_in_stream_wrappers
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:linking_in_stream_wrappers [2014/10/25 11:30] – thekid | rfc:linking_in_stream_wrappers [2021/03/27 14:47] (current) – Move to inactive ilutov | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2014-10-25 | * Date: 2014-10-25 | ||
* Author: Timm Friebe, thekid@php.net | * Author: Timm Friebe, thekid@php.net | ||
- | * Status: | + | |
+ | | ||
* First Published at: https:// | * First Published at: https:// | ||
Line 19: | Line 20: | ||
Currently, #2 and #3 are already supported by [[http:// | Currently, #2 and #3 are already supported by [[http:// | ||
- | Use case #1: | + | Use case #1 - **new functionality**: |
< | < | ||
class wrapper { | class wrapper { | ||
Line 50: | Line 51: | ||
<PHP> | <PHP> | ||
class wrapper { | class wrapper { | ||
+ | |||
+ | /** | ||
+ | * See http:// | ||
+ | * | ||
+ | * @param | ||
+ | * @param | ||
+ | * @return array or FALSE on error | ||
+ | */ | ||
function url_stat($url, | function url_stat($url, | ||
if ($flags & STREAM_URL_STAT_LINK) { | if ($flags & STREAM_URL_STAT_LINK) { | ||
// Stat the link, not the file it points to | // Stat the link, not the file it points to | ||
} | } | ||
+ | |||
+ | // ... | ||
return [ | return [ | ||
Line 63: | Line 74: | ||
</ | </ | ||
- | Use case #4: | + | Use case #4 - **new functionality**: |
<PHP> | <PHP> | ||
class wrapper { | class wrapper { | ||
/** | /** | ||
- | | + | * Reads a link and returns the target |
* | * | ||
* @param | * @param | ||
- | * @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 77: | Line 88: | ||
} | } | ||
} | } | ||
+ | </ | ||
+ | |||
+ | * When url_readlink() returns a string, it will be used as readlink()' | ||
+ | * When url_readlink() returns FALSE, readlink() quietly returns FALSE | ||
+ | * For all other return values of url_readlink(), | ||
+ | * When url_readlink() is not implemented, | ||
+ | |||
+ | ==== Limitations ==== | ||
+ | |||
+ | It will not be possible to create links between two different stream wrappers like this: | ||
+ | |||
+ | <PHP> | ||
+ | symlink(' | ||
</ | </ | ||
Line 112: | Line 136: | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
TODO: Implement and submit GitHub pull request. | TODO: Implement and submit GitHub pull request. | ||
+ | https:// | ||
===== References ===== | ===== References ===== | ||
- | See http:// | + | * http:// |
- | See https:// | + | * [[https:// |
+ | * [[https:// |
rfc/linking_in_stream_wrappers.1414236622.txt.gz · Last modified: 2017/09/22 13:28 (external edit)