8000 Merge branch '2.3' into 2.4 · symfony/symfony@53d5eca · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 53d5eca

Browse files
committed
Merge branch '2.3' into 2.4
* 2.3: Revert "bug #10894 [HttpKernel] removed absolute paths from the generated container (fabpot)" Revert "bug #10937 [HttpKernel] Fix "absolute path" when we look to the cache directory (BenoitLeveque)" Revert "fixed CS" Revert "bug #10979 Make rootPath part of regex greedy (artursvonda)" Revert "[HttpKernel] simplified some tests" [HttpKernel] simplified some tests Make rootPath part of regex greedy Conflicts: src/Symfony/Component/HttpKernel/Tests/KernelTest.php
2 parents 4ba44a7 + 5d13be7 commit 53d5eca

File tree

7 files changed

+1
-92
lines changed

7 files changed

+1
-92
lines changed

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
use Symfony\Component\Config\Loader\DelegatingLoader;
3333
use Symfony\Component\Config\ConfigCache;
3434
use Symfony\Component\ClassLoader\ClassCollectionLoader;
35-
use Symfony\Component\Filesystem\Filesystem;
3635

3736
/**
3837
* The Kernel is the heart of the Symfony system.
@@ -715,47 +714,9 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container
715714
$content = static::stripComments($content);
716715
}
717716

718-
$content = $this->removeAbsolutePathsFromContainer($content);
719-
720717
$cache->write($content, $container->getResources());
721718
}
722719

723-
/**
724-
* Converts absolute paths to relative ones in the dumped container.
725-
*/
726-
private function removeAbsolutePathsFromContainer($content)
727-
{
728-
if (!class_exists('Symfony\Component\Filesystem\Filesystem')) {
729-
return $content;
730-
}
731-
732-
// find the "real" root dir (by finding the composer.json file)
733-
$rootDir = $this->getRootDir();
734-
$previous = $rootDir;
735-
while (!file_exists($rootDir.'/composer.json')) {
736-
if ($previous === $rootDir = realpath($rootDir.'/..')) {
737-
// unable to detect the project root, give up
738-
return $content;
739-
}
740-
741-
$previous = $rootDir;
742-
}
743-
744-
$rootDir = rtrim($rootDir, '/');
745-
$cacheDir = $this->getCacheDir();
746-
$filesystem = new Filesystem();
747-
748-
return preg_replace_callback("{'([^']*)(".preg_quote($rootDir)."[^']*)'}", function ($match) use ($filesystem, $cacheDir) {
749-
$prefix = isset($match[1]) && $match[1] ? "'$match[1]'.__DIR__" : "__DIR__";
750-
751-
if ('.' === $relativePath = rtrim($filesystem->makePathRelative($match[2], $cacheDir), '/')) {
752-
return $prefix;
753-
}
754-
755-
return $prefix.".'/".$relativePath."'";
756-
}, $content);
757-
}
758-
759720
/**
760721
* Returns a loader for the container.
761722
*

src/Symfony/Component/HttpKernel/Tests/Fixtures/DumpedContainers/app/cache/dev/withAbsolutePaths.php

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/Symfony/Component/HttpKernel/Tests/Fixtures/DumpedContainers/app/cache/dev/withoutAbsolutePaths.php

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/Symfony/Component/HttpKernel/Tests/Fixtures/DumpedContainers/composer.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@
1616

1717
class KernelForTest extends Kernel
1818
{
19-
public function setRootDir($dir)
20-
{
21-
$this->rootDir = $dir;
22-
}
23-
2419
public function getBundleMap()
2520
{
2621
return $this->bundleMap;

src/Symfony/Component/HttpKernel/Tests/KernelTest.php

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -722,34 +722,6 @@ public function testTerminateDelegatesTerminationOnlyForTerminableInterface()
722722
$kernel->terminate(Request::create('/'), new Response());
723723
}
724724

725-
public function testRemoveAbsolutePathsFromContainer()
726-
{
727-
$kernel = new KernelForTest('dev', true);
728-
$kernel->setRootDir($symfonyRootDir = __DIR__.'/Fixtures/DumpedContainers/app');
729-
730-
$content = file_get_contents($symfonyRootDir.'/cache/dev/withAbsolutePaths.php');
731-
$content = str_replace('ROOT_DIR', __DIR__.'/Fixtures/DumpedContainers', $content);
732-
733-
$m = new \ReflectionMethod($kernel, 'removeAbsolutePathsFromContainer');
734-
$m->setAccessible(true);
735-
$content = $m->invoke($kernel, $content);
736-
$this->assertEquals(file_get_contents($symfonyRootDir.'/cache/dev/withoutAbsolutePaths.php'), $content);
737-
}
738-
739-
public function testRemoveAbsolutePathsFromContainerGiveUpWhenComposerJsonPathNotGuessable()
740-
{
741-
$kernel = new KernelForTest('dev', true);
742-
$kernel->setRootDir($symfonyRootDir = sys_get_temp_dir());
743-
744-
$content = file_get_contents(__DIR__.'/Fixtures/DumpedContainers/app/cache/dev/withAbsolutePaths.php');
745-
$content = str_replace('ROOT_DIR', __DIR__.'/Fixtures/DumpedContainers', $content);
746-
747-
$m = new \ReflectionMethod($kernel, 'removeAbsolutePathsFromContainer');
748-
$m->setAccessible(true);
749-
$newContent = $m->invoke($kernel, $content);
750-
$this->assertEquals($newContent, $content);
751-
}
752-
753725
/**
754726
* Returns a mock for the BundleInterface
755727
*

src/Symfony/Component/HttpKernel/composer.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"symfony/console": "~2.2",
3030
"symfony/dependency-injection": "~2.0",
3131
"symfony/finder": "~2.0",
32-
"symfony/filesystem": "~2.4",
3332
"symfony/process": "~2.0",
3433
"symfony/routing": "~2.2",
3534
"symfony/stopwatch": "~2.2",
@@ -41,8 +40,7 @@
4140
"symfony/config": "",
4241
"symfony/console": "",
4342
"symfony/dependency-injection": "",
44-
"symfony/finder": "",
45-
"symfony/filesystem": ""
43+
"symfony/finder": ""
4644
},
4745
"autoload": {
4846
"psr-0": { "Symfony\\Component\\HttpKernel\\": "" }

0 commit comments

Comments
 (0)
0