Wez Furlong wrote:
On Apr 9, 2005 6:07 AM, Morgan L. Owens <[EMAIL PROTECTED]> wrote:

> Really?
> Can you guarantee that your user-space code to sniff out the path is
> going to work 100% of the time on all platforms?
>
Who said user-space? I meant in the implementation of fopen().


fopen() is implemented in user-space, meaning, not kernel-space.
Only the kernel knows what logic it will really really use to resolve
a valid path.
Emulating that code for each supported platform on which PHP runs is
plain stupid.
I still don't see why emulation code would be necessary. What happens
when fopen() is passed an invalid file path now? It's obviously capable
of coping with failure. What is so unimplementable with it coping with
its initial failure by going "Drat. Okay, might it be a URL? Looks like
it has a scheme... let's try it". If you insist, you could wrap that in
#ifdefs so that the code is only compiled on platforms where 'foo:'
might validly appear at the start of a file path.

if(the string might be a URL)
{
#ifdef FILEPATHS_CAN_START_WITH_SCHEMELIKE_SEQUENCE
        if(attempt to open as local file succeeds)
                return handle
        else
#endif
        if(scheme is registered && attempt to open as stream succeeds)
                return handle
        else
                return fail
}
else
{
        if(attempt to open as local file succeeds)
                return handle
        else
                return fail
}


I suggest that you go and re-read RFC 1738, section 3.1, Common Internet Scheme Syntax. We support that, because the original wrappers implementation was solely for "URL schemes that involve the direct use of an IP-based protocol to a specified host on the Internet".

...

In other words, there is no defined mapping to a streaming data
source, which is what the wrappers layer in PHP is built for.

Sorry, I didn't see any mention of that in the documentation. Just saw
"URL" and assumed that it referred to RFC 2396, which IIRC would have been the current standard at the time. Nothing about direct use of an IP-based protocol to a specified host (like a local variable or a gzip'ed file?). If I could search back through the development discussion list over the relevant time period I'd've found this?


In short, what you're talking about supporting is (what is now) Section 3.2 of RFC 3986. Thanks for clearing that up.


Do you think that by trying to insult PHP you'll motivate the developers to try and change it to the way you think it should work?

Just characterising the sort of response I can imagine people not
married to PHP making when they first run into this. Hey, none of this is the result of any decision of mine. So I wasn't aware of which interpretation of "URL" you had chosen to use. Now that you've gotten around to saying which (to me, if not to those other users I mentioned), I've got my answer.


MLO

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



Reply via email to