[Debug] Fixed ClassNotFoundFatalErrorHandler on windows.
Because $path is realpath'ed. So we have to use DIRECTORY_SEPARATOR instead of / because the default directory separator on windows is \. And so the str_replace can not work and can lead to a fatal error because class could already be loaded. For example, the Response class in symfony full stack is in the bootstrap.php.cache.
This commit is contained in:
parent
836bc10952
commit
2ce8cd993e
@ -150,7 +150,7 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
|
||||
*/
|
||||
private function convertFileToClass($path, $file)
|
||||
{
|
||||
$namespacedClass = str_replace(array($path.'/', '.php', '/'), array('', '', '\\'), $file);
|
||||
$namespacedClass = str_replace(array($path.DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file);
|
||||
$pearClass = str_replace('\\', '_', $namespacedClass);
|
||||
|
||||
// We cannot use the autoloader here as most of them use require; but if the class
|
||||
|
Reference in New Issue
Block a user