Skip to content
This repository was archived by the owner on Dec 9, 2023. It is now read-only.

Commit a06d108

Browse files
committed
Merge branch '2.8' into 3.0
* 2.8: [ci] Get ICU/intl from github instead of nebm.ist.utl.pt/~glopes [Debug] Fix case sensitivity checks [Debug] Fix handling of php7 throwables fix high deps tests fix testing deprecation messages [Process] remove dead code [WebProfilerBundle] Add missing use statement. [ClassLoader] Fix storing not-found classes in APC cache [Form] cs fixes in date types [phpunit] disable prophecy
2 parents 3efe7b6 + 40bc319 commit a06d108

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

DebugClassLoader.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,25 @@ public function __construct(callable $classLoader)
4242
$this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
4343

4444
if (!isset(self::$caseCheck)) {
45-
if(!file_exists(strtolower(__FILE__))) {
45+
$file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR);
46+
$i = strrpos($file, DIRECTORY_SEPARATOR);
47+
$dir = substr($file, 0, 1 + $i);
48+
$file = substr($file, 1 + $i);
49+
$test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
50+
$test = realpath($dir.$test);
51+
52+
if (false === $test || false === $i) {
4653
// filesystem is case sensitive
4754
self::$caseCheck = 0;
48-
} elseif(realpath(strtolower(__FILE__)) === __FILE__) {
49-
// filesystem is not case sensitive
55+
} elseif (substr($test, -strlen($file)) === $file) {
56+
// filesystem is case insensitive and realpath() normalizes the case of characters
5057
self::$caseCheck = 1;
51-
} else {
52-
// filesystem is not case sensitive AND realpath() fails to normalize case
58+
} elseif (false !== stripos(PHP_OS, 'darwin')) {
59+
// on MacOSX, HFS+ is case insensitive but realpath() doesn't normalize the case of characters
5360
self::$caseCheck = 2;
61+
} else {
62+
// filesystem case checks failed, fallback to disabling them
63+
self::$caseCheck = 0;
5464
}
5565
}
5666
}

0 commit comments

Comments
 (0)