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
This commit is contained in:
commit
1da85a2b2d
@ -51,7 +51,16 @@ class DebugClassLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isset(self::$caseCheck)) {
|
if (!isset(self::$caseCheck)) {
|
||||||
self::$caseCheck = false !== stripos(PHP_OS, 'win') ? (false !== stripos(PHP_OS, 'darwin') ? 2 : 1) : 0;
|
if(!file_exists(strtolower(__FILE__))) {
|
||||||
|
// filesystem is case sensitive
|
||||||
|
self::$caseCheck = 0;
|
||||||
|
} elseif(realpath(strtolower(__FILE__)) === __FILE__) {
|
||||||
|
// filesystem is not case sensitive
|
||||||
|
self::$caseCheck = 1;
|
||||||
|
} else {
|
||||||
|
// filesystem is not case sensitive AND realpath() fails to normalize case
|
||||||
|
self::$caseCheck = 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user