diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php
index 603cbe8e22ef1..dbad1b653c1dd 100644
--- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php
+++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php
@@ -64,9 +64,13 @@ public function process(ContainerBuilder $container)
$container->getDefinition('twig.extension.debug')->addTag('twig.extension');
}
+ $composerRootDir = $this->getComposerRootDir($container->getParameter('kernel.root_dir'));
+ $loader = $container->getDefinition('twig.loader.filesystem');
+ $loader->replaceArgument(2, $composerRootDir);
+
if (!$container->has('templating')) {
$loader = $container->getDefinition('twig.loader.native_filesystem');
- $loader->replaceArgument(1, $this->getComposerRootDir($container->getParameter('kernel.root_dir')));
+ $loader->replaceArgument(1, $composerRootDir);
$loader->addTag('twig.loader');
$loader->setMethodCalls($container->getDefinition('twig.loader.filesystem')->getMethodCalls());
diff --git a/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php b/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php
index 53fe300e29a62..0a9ac7a3ca19a 100644
--- a/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php
+++ b/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php
@@ -29,12 +29,13 @@ class FilesystemLoader extends \Twig_Loader_Filesystem
/**
* Constructor.
*
- * @param FileLocatorInterface $locator A FileLocatorInterface instance
- * @param TemplateNameParserInterface $parser A TemplateNameParserInterface instance
+ * @param FileLocatorInterface $locator A FileLocatorInterface instance
+ * @param TemplateNameParserInterface $parser A TemplateNameParserInterface instance
+ * @param string|null $rootPath The root path common to all relative paths (null for getcwd())
*/
- public function __construct(FileLocatorInterface $locator, TemplateNameParserInterface $parser)
+ public function __construct(FileLocatorInterface $locator, TemplateNameParserInterface $parser, $rootPath = null)
{
- parent::__construct(array());
+ parent::__construct(array(), $rootPath);
$this->locator = $locator;
$this->parser = $parser;
diff --git a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
index c82cbafbeb953..06af08d15ba7a 100644
--- a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
+++ b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
@@ -46,12 +46,13 @@
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: