From 2ce8cd993e8c9ea1edbc4f37a68bccc4de0ed7c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Tue, 15 Apr 2014 18:41:05 +0200 Subject: [PATCH] [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. --- .../Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php b/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php index 98418b0497..929ad903eb 100644 --- a/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php +++ b/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php @@ -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