8000 [Debug] Replaced logic for detecting filesystem case sensitivity by blowski · Pull Request #18126 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Debug] Replaced logic for detecting filesystem case sensitivity #18126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
8000 Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[Debug] Replaced logic for detecting filesystem case sensitivity
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).
  • Loading branch information
Dan Blows committed Mar 12, 2016
commit 6a66c4882abbbbfeeef4117e9cbe333431b903db
14 changes: 13 additions & 1 deletion src/Symfony/Component/Debug/DebugClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,19 @@ public function __construct($classLoader)
}

if (!isset(self::$caseCheck)) {
self::$caseCheck = false !== stripos(PHP_OS, 'win') ? (false !== stripos(PHP_OS, 'darwin') ? 2 : 1) : 0;
if (!isset(self::$caseCheck)) {
if(!file_exists(strtolower(__FILE__))) {
// filesystem is case sensitive
self::$caseCheck = 0;
} elseif(realpath(strtolower(__FILE__)) === realpath(__FILE__)) {
// filesystem is not case sensitive
self::$caseCheck = 1;
} else {
// filesystem is not case sensitive AND realpath() fails to normalize case
// this is _probably_ OX
self::$caseCheck = 2;
}
}
}
}

Expand Down
0