HaxeFoundation / haxe

Haxe - The Cross-Platform Toolkit
https://haxe.org
6.16k stars 656 forks source link

[PHP, PHP7] sys.FileSystem.exists inconsistent with Neko when path to a file has trailing slash #6592

Open piotrpawelczyk opened 7 years ago

piotrpawelczyk commented 7 years ago

If an actual file /tmp/some.file (not directory) exists and following code is run

trace(sys.FileSystem.exists("/tmp/some.file")); // Neko: true, PHP/PHP7: true
trace(sys.FileSystem.exists("/tmp/some.file/")); // Neko: true, PHP/PHP7: false

thus requiring to use sys.io.Path.normalize before using this function on PHP target.

Don't know if it should be treated as a bug but this inconsistence between targets should at least be mentioned in the docs (probably as well as a fact that calls to that function are cached by PHP).

Didn't check with other targets (seems specific to PHP though).

RealyUniqueName commented 7 years ago

How do other sys targets behave in this case?

Simn commented 7 years ago

Returning true there looks wrong to me... I'd expect this to be true only if some.file is a directory.