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

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

Reply via email to