Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[ClassLoader] Use only forward slashes in generated class map #20676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[ClassLoader] Use only forward slashes in generated class map
  • Loading branch information
nicolas-grekas committed Nov 28, 2016
commit f77520bf34b4b037a4dc40d8cd52363ed9f99b37
12 changes: 6 additions & 6 deletions 12 src/Symfony/Component/ClassLoader/ClassCollectionLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive =
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;
Expand Down Expand Up @@ -114,7 +114,7 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive =
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) {
Expand All @@ -126,19 +126,19 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive =
$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]) {
break;
}
}
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;}";
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.