Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98707 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74398 invoked from network); 31 Mar 2017 22:16:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Mar 2017 22:16:50 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 77.244.243.82 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.82 mx101.easyname.com Received: from [77.244.243.82] ([77.244.243.82:46986] helo=mx101.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 01/10-08127-055DED85 for ; Fri, 31 Mar 2017 17:16:49 -0500 Received: from cable-81-173-132-37.netcologne.de ([81.173.132.37] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1cu4a9-0007yk-FG; Fri, 31 Mar 2017 21:59:47 +0000 Reply-To: internals@lists.php.net References: <4daabd46-4dc2-1c33-f89f-664f803c6cd5@fleshgrinder.com> <9d484a45-6311-7efa-05b1-419abaa58794@fleshgrinder.com> <96a2b011-4c5a-399b-a1fe-ea2f35bd202e@fleshgrinder.com> To: Anatol Belski , "internals@lists.php.net" , Rasmus Schultz Message-ID: Date: Fri, 31 Mar 2017 23:59:41 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-DNSBL-PBLSPAMHAUS: YES Subject: Re: [PHP-DEV] Directory separators on Windows From: php@fleshgrinder.com (Fleshgrinder) 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