8000 bug #18130 [Debug] Replaced logic for detecting filesystem case sensi… · symfony/symfony@1da85a2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1da85a2

Browse files
bug #18130 [Debug] Replaced logic for detecting filesystem case sensitivity (Dan Blows)
This PR was squashed before being merged into the 2.7 branch (closes #18130). Discussion ---------- [Debug] Replaced logic for detecting filesystem case sensitivity | Q | A | ------------- | --- | Branch | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | none | License | MIT | Doc PR | none When I cloned the master branch onto a Virtualbox Vagrant OSX El Capitan host, Ubuntu Wily guest, the `Symfony\Component\Debug\Tests\DebugClassLoaderTest::testFileCaseMismatch` failed because 'Failed asserting that exception of type "\RuntimeException" is thrown'. @wouterj confirmed he got the same problem, and it's because Virtualbox shared folders aren't case sensitive, even when the guest is using a case sensitive filesystem. So I've replaced the logic that looked at the name of the operating system. I ran the tests in the following environments: * Virtualbox/Vagrant - OSX Host, Ubuntu guest * Virtualbox/Vagrant - OSX Host, Windows guest * OSX native * Ubuntu native NB - I _didn't_ run it on native Windows (because I don't have easy access to one). Commits ------- 2e81b0a [Debug] Replaced logic for detecting filesystem case sensitivity
2 parents b228378 + 2e81b0a commit 1da85a2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Symfony/Component/Debug/DebugClassLoader.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,16 @@ public function __construct($classLoader)
5151
}
5252

5353
if (!isset(self::$caseCheck)) {
54-
self::$caseCheck = false !== stripos(PHP_OS, 'win') ? (false !== stripos(PHP_OS, 'darwin') ? 2 : 1) : 0;
54+
if(!file_exists(strtolower(__FILE__))) {
55+
// filesystem is case sensitive
56+
self::$caseCheck = 0;
57+
} elseif(realpath(strtolower(__FILE__)) === __FILE__) {
58+
// filesystem is not case sensitive
59+
self::$caseCheck = 1;
60+
} else {
61+
// filesystem is not case sensitive AND realpath() fails to normalize case
62+
self::$caseCheck = 2;
63+
}
5564
}
5665
}
5766

0 commit comments

Comments
 (0)
0