File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
src/Symfony/Component/Debug Expand file tree Collapse file tree 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)
5151 }
5252
5353 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 ) {
5562 // filesystem is case sensitive
5663 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
5966 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
6269 self ::$ caseCheck = 2 ;
70+ } else {
71+ // filesystem case checks failed, fallback to disabling them
72+ self ::$ caseCheck = 0 ;
6373 }
6474 }
6575 }
You can’t perform that action at this time.
0 commit comments