Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 853f681

Browse files
committed
fixed request scope issues (refs #7457)
1 parent e9bd48e commit 853f681

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\SerializerPass;
2929
use Symfony\Component\DependencyInjection\ContainerBuilder;
3030
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
31+
use Symfony\Component\DependencyInjection\Scope;
3132
use Symfony\Component\HttpFoundation\Request;
3233
use Symfony\Component\HttpKernel\Bundle\Bundle;
3334
use Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass;
@@ -54,6 +55,10 @@ public function build(ContainerBuilder $container)
5455
{
5556
parent::build($container);
5657

58+
// we need to add the request scope as early as possible so that
59+
// the compilation can find scope widening issues
60+
$container->addScope(new Scope('request'));
61+
5762
$container->addCompilerPass(new RoutingResolverPass());
5863
$container->addCompilerPass(new ProfilerPass());
5964
$container->addCompilerPass(new RegisterListenersPass(), PassConfig::TYPE_AFTER_REMOVING);

src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ public function __construct(EventDispatcherInterface $dispatcher, ContainerInter
4242
parent::__construct($dispatcher, $controllerResolver);
4343

4444
$this->container = $container;
45-
$container->addScope(new Scope('request'));
45+
46+
// the request scope might have been created before (see FrameworkBundle)
47+
if (!$container->hasScope('request')) {
48+
$container->addScope(new Scope('request'));
49+
}
4650
}
4751

4852
/**

0 commit comments

Comments
 (0)