[ClassLoader] Use only forward slashes in generated class map
This commit is contained in:
parent
ec937cbcd9
commit
6d1f1b5d4a
@ -63,7 +63,7 @@ class ClassCollectionLoader
|
|||||||
throw new \RuntimeException(sprintf('Class Collection Loader was not able to create directory "%s"', $cacheDir));
|
throw new \RuntimeException(sprintf('Class Collection Loader was not able to create directory "%s"', $cacheDir));
|
||||||
}
|
}
|
||||||
$cacheDir = rtrim(realpath($cacheDir) ?: $cacheDir, '/'.DIRECTORY_SEPARATOR);
|
$cacheDir = rtrim(realpath($cacheDir) ?: $cacheDir, '/'.DIRECTORY_SEPARATOR);
|
||||||
$cache = $cacheDir.DIRECTORY_SEPARATOR.$name.$extension;
|
$cache = $cacheDir.'/'.$name.$extension;
|
||||||
|
|
||||||
// auto-reload
|
// auto-reload
|
||||||
$reload = false;
|
$reload = false;
|
||||||
@ -114,7 +114,7 @@ class ClassCollectionLoader
|
|||||||
REGEX;
|
REGEX;
|
||||||
$dontInlineRegex = str_replace('.', $spacesRegex, $dontInlineRegex);
|
$dontInlineRegex = str_replace('.', $spacesRegex, $dontInlineRegex);
|
||||||
|
|
||||||
$cacheDir = explode(DIRECTORY_SEPARATOR, $cacheDir);
|
$cacheDir = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $cacheDir));
|
||||||
$files = array();
|
$files = array();
|
||||||
$content = '';
|
$content = '';
|
||||||
foreach (self::getOrderedClasses($classes) as $class) {
|
foreach (self::getOrderedClasses($classes) as $class) {
|
||||||
@ -126,7 +126,7 @@ REGEX;
|
|||||||
$c = file_get_contents($file);
|
$c = file_get_contents($file);
|
||||||
|
|
||||||
if (preg_match($dontInlineRegex, $c)) {
|
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) {
|
for ($i = 0; isset($file[$i], $cacheDir[$i]); ++$i) {
|
||||||
if ($file[$i] !== $cacheDir[$i]) {
|
if ($file[$i] !== $cacheDir[$i]) {
|
||||||
@ -134,11 +134,11 @@ REGEX;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (1 >= $i) {
|
if (1 >= $i) {
|
||||||
$file = var_export(implode(DIRECTORY_SEPARATOR, $file), true);
|
$file = var_export(implode('/', $file), true);
|
||||||
} else {
|
} else {
|
||||||
$file = array_slice($file, $i);
|
$file = array_slice($file, $i);
|
||||||
$file = str_repeat('..'.DIRECTORY_SEPARATOR, count($cacheDir) - $i).implode(DIRECTORY_SEPARATOR, $file);
|
$file = str_repeat('../', count($cacheDir) - $i).implode('/', $file);
|
||||||
$file = '__DIR__.'.var_export(DIRECTORY_SEPARATOR.$file, true);
|
$file = '__DIR__.'.var_export('/'.$file, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$c = "\nnamespace {require $file;}";
|
$c = "\nnamespace {require $file;}";
|
||||||
|
Reference in New Issue
Block a user