Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98704 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57227 invoked from network); 31 Mar 2017 18:33:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Mar 2017 18:33:27 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 212.232.25.162 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 212.232.25.162 mx206.easyname.com Received: from [212.232.25.162] ([212.232.25.162:35809] helo=mx206.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0A/00-56209-5F0AED85 for ; Fri, 31 Mar 2017 13:33:25 -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 1cu1LO-0001Zp-26; Fri, 31 Mar 2017 18:32:18 +0000 Reply-To: internals@lists.php.net References: <4daabd46-4dc2-1c33-f89f-664f803c6cd5@fleshgrinder.com> <9d484a45-6311-7efa-05b1-419abaa58794@fleshgrinder.com> To: Anatol Belski , "internals@lists.php.net" , Rasmus Schultz Message-ID: <96a2b011-4c5a-399b-a1fe-ea2f35bd202e@fleshgrinder.com> Date: Fri, 31 Mar 2017 20:32:11 +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 X-DNSBL-SURBL: YES Subject: Re: [PHP-DEV] Directory separators on Windows From: php@fleshgrinder.com (Fleshgrinder) Hey :) On 3/31/2017 7:51 PM, Anatol Belski wrote: > Well, there was slightly more in your msg, thus the response ? > Not really: On 3/30/2017 8:05 PM, Fleshgrinder wrote: > Windows and paths is a complicated and lengthy story. > > TL;DR all versions of Windows are able to deal with slashes, and we > could easily use slashes everywhere all the time. > The rest was under the heading "History". On 3/31/2017 7:51 PM, Anatol Belski wrote: > Path normalization and forward slash everywhere are two different > things. Having forward slash just because it is supported - nope, > it's more an issue and should not be done. The path can be used > everywhere - in the script itself, passed to external prog, written > into a file, etc. The suggested "always forward slash" will cause > endless conversion back and forth, in both user space and internally. > Please check the 7.1 related parts, or even earlier versions, we > already have to do some conversions because of these and similar > matters, doing yet more while introducing breakages for existing > software doesn't sound necessary. Any individual case in the given > app is what matters. > $ php71 -a php > echo dirname('C:\Folder/Resource\Resource'); C:\Folder/Resource hmmm... just one example, this is what this whole discussion is about. We are already super inconsistent. It seems as if this is not producing any issues with PHP itself, as well as at least every extension I ever interacted with. Of course things are very different when it is about outputting paths and forwarding them to other programs, which might be super shitty. (I look at you protoc from Google, **grrr**.) However, that is something where `realpath`/`path_canonicalize`/`path_normalize` would come into play, and something I would leave to the applications. Choosing the right situation where the path requires those actions is impossible. We could also consistently convert paths to their native form. Hence, above example would result in `C:\Folder\Resource`, or even `\\?\C:\Folder\Resource` (verbatim path, no further fiddling allowed). On 3/31/2017 7:51 PM, Anatol Belski wrote: > Yep, a function to normalize path were doable. But again, the current > implementations are platform dependent and use platform APIs. Such a > function might need a re-implementations of those APIs, to produce > results platform independently, that are valid on the target > platform. Otherwise, more generalization doesn't look like having a > base in absence of a consistent specs, at least I haven't seen any. > Well, until someone takes it in the hand and files a draft to IETF > ? > > Regards > > Anatol > Both POSIX and Windows paths are well documented. However, it's not an easy topic, that is for sure, and using slashes everywhere might be more destructive than I anticipate. -- Richard "Fleshgrinder" Fussenegger