File tree 1 file changed +15
-5
lines changed
src/Symfony/Component/Debug
1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -51,15 +51,25 @@ public function __construct($classLoader)
51
51
}
52
52
53
53
if (!isset (self ::$ caseCheck )) {
54
- if (!file_exists (strtolower (__FILE__ ))) {
54
+ $ file = file_exists (__FILE__ ) ? __FILE__ : rtrim (realpath ('. ' ), DIRECTORY_SEPARATOR );
55
+ $ i = strrpos ($ file , DIRECTORY_SEPARATOR );
56
+ $ dir = substr ($ file , 0 , 1 + $ i );
57
+ $ file = substr ($ file , 1 + $ i );
58
+ $ test = strtoupper ($ file ) === $ file ? strtolower ($ file ) : strtoupper ($ file );
59
+ $ test = realpath ($ dir .$ test );
60
+
61
+ if (false === $ test || false === $ i ) {
55
62
// filesystem is case sensitive
56
63
self ::$ caseCheck = 0 ;
57
- } elseif ( realpath ( strtolower ( __FILE__ )) === __FILE__ ) {
58
- // filesystem is not case sensitive
64
+ } elseif ( substr ( $ test , - strlen ( $ file )) === $ file ) {
65
+ // filesystem is case insensitive and realpath() normalizes the case of characters
59
66
self ::$ caseCheck = 1 ;
60
- } else {
61
- // filesystem is not case sensitive AND realpath() fails to normalize case
67
+ } elseif ( false !== stripos ( PHP_OS , ' darwin ' )) {
68
+ // on MacOSX, HFS+ is case insensitive but realpath() doesn't normalize the case of characters
62
69
self ::$ caseCheck = 2 ;
70
+ } else {
71
+ // filesystem case checks failed, fallback to disabling them
72
+ self ::$ caseCheck = 0 ;
63
73
}
64
74
}
65
75
}
You can’t perform that action at this time.
0 commit comments