|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-04-01 17:01 UTC] a at b dot c dot de
Description: ------------ As indicated several times in the manual, the "filenames" that result from using stream wrappers are to be regarded as URLs, just as http, ftp and file schemes already are. However, ALL such wrappers separate the scheme (what the manual refers to as the "protocol" from the rest of the URL with "://" - an example being the "var://myvar" in the example of the stream_wrapper_register() page. This conflicts with RFC3986, the official specification for URIs (of which URLs are a subclass). The separator is just ":"; the double slash should only appear if what follows is a hierarchical structure in the sense given in section 3 of that document. This is explicitly stated as improper in RFC2718, section 2.1.2 (which refers to the previous URI standard, RFC2396). If these streams are supposed to be URLs, then the above example from the manual should read "var:myvar". PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 14:00:01 2025 UTC |
From RFC 3986: '... The term "Uniform Resource Locator" (URL) refers to the subset of URIs that, in addition to identifying a resource, provide a means of locating the resource by describing its primary access mechanism (e.g., its network "location"). ...' I do not see the conflict, the use of URL syntax is akin to the use of the valid location address of a file in a local filesystem, i.e. (as mentioned in the document quoted above): '... URIs that identify in relation to the end-user's local context should only be used when the context itself is a defining aspect of the resource, such as when an on-line help manual refers to a file on the end-user's file system (e.g., "file:///etc/hosts"). ...' A URN is also an URI (from which URLs are also a subset), and in that case, the syntax mentioned by the user is valid, although URNs are names, and usually used for resources without regard to their accessibility. For example, URNs are used for LSIDs to refer to unique DNA sequences. Furthermore, in 1.2.3, it is said: '... The generic syntax uses the slash ("/"), question mark ("?"), and number sign ("#") characters to delimit components that are significant to the generic parser's hierarchical interpretation of an identifier. In addition to aiding the readability of such identifiers through the consistent use of familiar syntax, this uniform representation of hierarchy across naming schemes allows scheme-independent references to be made relative to that hierarchy. ...' In any case, to make it more consistent, we should use then: stream://authority/path/to/remote/fileorresource where authority, can be the name of a server. accordingly, if addressing a local resource: stream:///path/to/local/resource All of these will require modification of the code for handling stream names.Withdrawing the original report: it _is_ a documentation problem as reclassified. The examples shouldn't be using // indiscriminately (as in the "var://myvar" example), but only when appropriate. The distinction should be made, otherwise broken usages of parse_url() would become common (as in the given example, where the indicated variable name is in the "host" part of the URL, rather than the "path"). Nowhere is it actually stated how PHP decides which wrapper to use - the fact that it reads up to ':' (and not '://') is only _implicit_. No mention is made of the fact that the scheme name must not contain ':' (which one might be led to expect is possible if the scheme only ends with a "://"; especially since it would be succesfully registered. But that's a story for another bug (#32563). Rewriting the documentation to use URL terminology ("scheme" rather than "protocol", for example) may also be a good idea.