On 3/31/2017 9:29 PM, Anatol Belski wrote: > I can only link to this 😉 > > http://git.php.net/?p=php-src.git;a=commitdiff;h=ec78507bd46a05f77dbde3fa4091ab4c91e61cad > > the new implementation was consistent but had to be reverted in 7.1 > partially, because of BC, even the use is inappropriate. Well, still > normalization on Windows means having '\\' in terms of the platform > API used, but just as a show case. The dirname function itself is > based on the PHP implementation, not a platform API. But also, it > would produce same path with different separators on different > platform, if normalized. >
A good example that showcases that we actually could normalize to slashes, don't you think. :) Besides, I still believe that it is very wrong of PHP to treat URIs/URLs the same as paths. A path can be a URI, but a URI should only be a path if it has the `file://` scheme. The current approach just asks for remote code inclusion, URL fopen anyone? Different story though. On 3/31/2017 9:29 PM, Anatol Belski wrote: > You're right, they both are documented. What is not defined is the > cross platform handling. There are some documents, yes, like RFC > 3986, or RFC 1738 and RFC 8089 which are still in the proposed state. > However there is none I knew that would care about crossplatform > nuances in full extent. Particularly an RFC defining all the possible > behaviors of the file:// scheme is what were needed, I guess. Thus my > conclusion is to take the path of less resistance, as what is not > defined is not necessary good but also is not necessary broken. Yeah, > it is complex, and particularly in PHP historically grown, and just > touching the water surface might already produce some high waves. > > The functions mentioned - of course, it were up to an application to > decide what to use it in a particular situation, but not forcibly > changing the core handling. Like in the snippet above, you would have > currently to do dirname(realpath($path)), but that is also not > crossplatform and won't work on a nonexistent file. So another > function instead of realpath, like dirname(normalize_path($path, > UNIXIFY_SLASH)) were in use. The implementation might be tricky in > some parts, but in general doable. > > Regards > > Anatol > Well, RFC 8089 has many examples in its appendix regarding Windows. It's true that they say that it is non-standard, however, it is how Windows deals with it since IE4. https://blogs.msdn.microsoft.com/freeassociations/2005/05/19/the-bizarre-and-unhappy-story-of-file-urls/ -- Richard "Fleshgrinder" Fussenegger -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php