If there's something that looks like a scheme (i.e., a well-formed sequence of
characters followed by ':'),
see if it's registered;
if it is,
the appropriate wrapper should be used.
Otherwise,
on platforms where ':' has significance,
try it again as a file path.
Otherwise, it fails due to an absent stream wrapper.


This limits problems to users who are trying to access a child directory of the
current path which happens to have the same name as a registered scheme. The
problems will consist of the stream failing because the URL it's receiving is
bogus. People in such a situation can use the file: scheme explicitly to
disambiguate (assuming they can't have a directory whose name starts with
a double slash!).


Alternately,
on problem platforms,
        if the string is ambiguous,
                see if it is well-formed as a file path.
                If it is,
                        try it as such.
                If it's not, or it fails,
                        see if it starts with a registered scheme name and if 
so,
                                try that.

It would be easier to check if a string is a well-formed file path than it is to
check if it's a valid URL according to some arbitrary scheme (impossible in
general).


Assuming no-one tries to register a one-letter scheme, the Windows build can get
away with seeing if the "scheme" is only one letter long, and if it is, assume
that it's a drive letter.


I dunno; Windows users use '/' as the directory separator in file:// URLs, since
it's supposed to be up to the application to map a URL to the actual resource
('\' is frequently tolerated however) in whatever platform-specific manner is
appropriate; does the same hold for platforms that use ':' as the directory
separator in their file: URLs? Currently the standard for file URLs is still
RFC1738; this is supposed to be updated at some stage, however. It explicitly
gives the VMS example of mapping
DISK$USER:[MY.NOTES]NOTE123456.TXT
on vms.host.edu to the URL
file://vms.host.edu/disk$user/my/notes/note12345.txt
and noting that to refer to the local machine the host part can be either
'localhost' or the empty string.


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to