Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98702 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49261 invoked from network); 31 Mar 2017 16:29:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Mar 2017 16:29:18 -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.86 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.86 mx105.easyname.com Received: from [77.244.243.86] ([77.244.243.86:60874] helo=mx105.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 57/73-11319-BD38ED85 for ; Fri, 31 Mar 2017 11:29:16 -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 1ctzQG-000284-65; Fri, 31 Mar 2017 16:29:12 +0000 Reply-To: internals@lists.php.net References: <4daabd46-4dc2-1c33-f89f-664f803c6cd5@fleshgrinder.com> To: Anatol Belski , "internals@lists.php.net" , Rasmus Schultz Message-ID: <9d484a45-6311-7efa-05b1-419abaa58794@fleshgrinder.com> Date: Fri, 31 Mar 2017 18:29:08 +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: 7bit X-DNSBL-PBLSPAMHAUS: YES Subject: Re: [PHP-DEV] Directory separators on Windows From: php@fleshgrinder.com (Fleshgrinder) On 3/31/2017 12:33 PM, Anatol Belski wrote: > Regarding the path variants support - it's not quite that way. PHP > streams abstract many things, for both simplicity and security. The > current state has historically grown on these two factors. So far I > can tell, the only what we don't support is a drive relative path and > don't handle several irrelevant prefixes like device UID. > > While in general the info above is correct, things still stay > platform dependent in many cases, while supported in PHP, too. Fe > using "/" to access drive root ofc works, but might be surprisingly > wrong if CWD is changed to another drive. Well, that's the platform > nuance, with DOS one can have multiple roots. In other cases, like > UNC, links or lately the long path prefix, the handling with PHP > streams is completely transparent to the consuming script. > > A given case with a generated file is clearly the app responsibility. > It is likely, that generated files moved between systems can cause > arbitrary issues disregarding the actual platform. The mentioned case > belongs to the same group, where I'd say there is no and cannot be a > plausible general "fix". In addition to the EOL example by Rowan, > another one of same could be escapeshell* functions. Taking in > account also > > - backward compatibility - platform specific - compatibility with > dependency libs, especially where it's impossible to integrate PHP > streams - absence of the cross platform specifications, which is IMO > the most of issue > > Even if we'd abstract ourselves from the initial app responsibility > case - there are the portability nuances that are not simply to clear > away by just renaming 'a' to 'b'. > > Regards > > Anatol > Slow with the horses, we were only talking about backslash vs. slash, not anything else. I only explained the various paths that are available on Windows. We could use slashes everywhere, because every platform that is still in existence supports it. That's about it, we cannot do much more, well, maybe some normalization (e.g. self-references like `a/./b` to `a/b`, or removing multiple slashes `a//b` to `a/b`). That's about it. Any other cross-platform issues are not solvable, and must be handled by applications. A proper path abstraction would be awesome. Of course I would prefer an object for it, but offering a `path_canonicalize` function as well for starters is good too. -- Richard "Fleshgrinder" Fussenegger