diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 15552a7c6ba4b..09982b3caa3f0 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -746,9 +746,15 @@ private function removeAbsolutePathsFromContainer($content) $filesystem = new Filesystem(); return preg_replace_callback("{'([^']*)(".preg_quote($rootDir)."[^']*)'}", function ($match) use ($filesystem, $cacheDir) { - $prefix = isset($match[1]) && $match[1] ? "'$match[1]'.__DIR__.'/" : "__DIR__.'/"; + $prefix = isset($match[1]) && $match[1] ? "'$match[1]'.__DIR__" : "__DIR__"; - return $prefix.rtrim($filesystem->makePathRelative($match[2], $cacheDir), '/')."'"; + $relativePath = rtrim($filesystem->makePathRelative($match[2], $cacheDir), '/'); + + if ($relativePath === '.') { + return $prefix; + } + + return $prefix . ".'/" . $relativePath . "'"; }, $content); } diff --git a/src/Symfony/Component/HttpKernel/Tests/Fixtures/DumpedContainers/app/cache/dev/withAbsolutePaths.php b/src/Symfony/Component/HttpKernel/Tests/Fixtures/DumpedContainers/app/cache/dev/withAbsolutePaths.php index 54e0dedc4bfd5..b8644ecb9fe00 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Fixtures/DumpedContainers/app/cache/dev/withAbsolutePaths.php +++ b/src/Symfony/Component/HttpKernel/Tests/Fixtures/DumpedContainers/app/cache/dev/withAbsolutePaths.php @@ -1,6 +1,7 @@ 'ROOT_DIR/app/cache/dev/foo' 'ROOT_DIR/app/cache/foo' 'ROOT_DIR/foo/bar.php' +'ROOT_DIR/app/cache/dev' '/some/where/else/foo' diff --git a/src/Symfony/Component/HttpKernel/Tests/Fixtures/DumpedContainers/app/cache/dev/withoutAbsolutePaths.php b/src/Symfony/Component/HttpKernel/Tests/Fixtures/DumpedContainers/app/cache/dev/withoutAbsolutePaths.php index 09ce8b5683927..36823dfc160c8 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Fixtures/DumpedContainers/app/cache/dev/withoutAbsolutePaths.php +++ b/src/Symfony/Component/HttpKernel/Tests/Fixtures/DumpedContainers/app/cache/dev/withoutAbsolutePaths.php @@ -1,6 +1,7 @@ __DIR__.'/foo' __DIR__.'/../foo' __DIR__.'/../../../foo/bar.php' +__DIR__ '/some/where/else/foo' pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy