From 6d1f1b5d4ade77b53de83064cecadfb01fb20eed Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 28 Nov 2016 20:51:39 +0100 Subject: [PATCH] [ClassLoader] Use only forward slashes in generated class map --- .../Component/ClassLoader/ClassCollectionLoader.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php index 593ed44ca0..5d09848952 100644 --- a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php +++ b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php @@ -63,7 +63,7 @@ class ClassCollectionLoader throw new \RuntimeException(sprintf('Class Collection Loader was not able to create directory "%s"', $cacheDir)); } $cacheDir = rtrim(realpath($cacheDir) ?: $cacheDir, '/'.DIRECTORY_SEPARATOR); - $cache = $cacheDir.DIRECTORY_SEPARATOR.$name.$extension; + $cache = $cacheDir.'/'.$name.$extension; // auto-reload $reload = false; @@ -114,7 +114,7 @@ class ClassCollectionLoader REGEX; $dontInlineRegex = str_replace('.', $spacesRegex, $dontInlineRegex); - $cacheDir = explode(DIRECTORY_SEPARATOR, $cacheDir); + $cacheDir = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $cacheDir)); $files = array(); $content = ''; foreach (self::getOrderedClasses($classes) as $class) { @@ -126,7 +126,7 @@ REGEX; $c = file_get_contents($file); if (preg_match($dontInlineRegex, $c)) { - $file = explode(DIRECTORY_SEPARATOR, $file); + $file = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $file)); for ($i = 0; isset($file[$i], $cacheDir[$i]); ++$i) { if ($file[$i] !== $cacheDir[$i]) { @@ -134,11 +134,11 @@ REGEX; } } if (1 >= $i) { - $file = var_export(implode(DIRECTORY_SEPARATOR, $file), true); + $file = var_export(implode('/', $file), true); } else { $file = array_slice($file, $i); - $file = str_repeat('..'.DIRECTORY_SEPARATOR, count($cacheDir) - $i).implode(DIRECTORY_SEPARATOR, $file); - $file = '__DIR__.'.var_export(DIRECTORY_SEPARATOR.$file, true); + $file = str_repeat('../', count($cacheDir) - $i).implode('/', $file); + $file = '__DIR__.'.var_export('/'.$file, true); } $c = "\nnamespace {require $file;}";