Bug #78939 [PATCH]: file_exists produces different results with TS and NTS builds

From: Date: Tue, 10 Dec 2019 18:13:31 +0000
Subject: Bug #78939 [PATCH]: file_exists produces different results with TS and NTS builds
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224207@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78939&edit=1 ID: 78939 Patch added by: cmb@php.net Reported by: michael dot vorisek at email dot cz Summary: file_exists produces different results with TS and NTS builds Status: Feedback Type: Bug Package: *Directory/Filesystem functions Operating System: Windows PHP Version: 7.3.12 Block user comment: N Private report: N New Comment: The following pull request has been associated: Patch Name: Fix #78939 - Windows relative path with drive letter On GitHub: https://github.com/php/php-src/pull/5001 Patch: https://github.com/php/php-src/pull/5001.patch Previous Comments: ------------------------------------------------------------------------ [2019-12-10 14:52:11] fgfgfgfdf at somewhere dot com > PHP currently ignores this fact completely and resolves > relative paths with drive letter like absolute ones PHP resolves nothing, windows does ------------------------------------------------------------------------ [2019-12-10 14:28:21] michael dot vorisek at email dot cz No! I am just reporting, that relative path with drive letter is not resolved correctly. If this path format should be supported, it needs to be resolved like PHP resolve any other relative relative paths. PHP currently ignores this fact completely and resolves relative paths with drive letter like absolute ones. ------------------------------------------------------------------------ [2019-12-10 14:12:07] requinix@php.net And if your expected behavior on Windows is that "C:/x.txt" and "C:/X.TXT" are two different files, you would be equally wrong. ------------------------------------------------------------------------ [2019-12-10 13:30:36] michael dot vorisek at email dot cz Yes, only contemplation for easier fix and to prevent missuses... The current issue is that PHP does not resolves relative paths the same way. The expected behaviour is, if your current directory is in C: drive, then all usages like: "x.txt", "./x.txt" and "C:x.txt" point to the same file. ------------------------------------------------------------------------ [2019-12-10 13:22:57] requinix@php.net That might have been a bit blunt. My point is, you had some sort of problem that you tracked down (congratulations) to some sort of incorrect file path configuration... code... something. And now you have learned that "C:x.txt" and "C:/x.txt" can potentially mean two different things because the former is a relative path and the latter is absolute. Normally this sort of situation becomes resolved at this point because it's considered an issue of user education, and once the teaching is done and the code is fixed, everything starts working again. But you're apparently looking for something more and I, personally, am not seeing what should happen next. It's not like the behavior is wrong - maybe it's a bit unexpected, but that isn't PHP's fault. The only thing I can think of is documentation, but there are *tons* of little Windows nuances out there and I don't think it's reasonable to expect PHP to try to cover them. Prohibit the unusual behavior? That seems like it would punish more people for using the feature than help people who were accidentally using it (and somehow not noticing a problem?). ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=78939 -- Edit this bug report at https://bugs.php.net/bug.php?id=78939&edit=1

« previous php.bugs (#224207) next »