Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[HttpKernel] ensured that the Request is null when outside of the Req…

…uest scope
  • Loading branch information...
commit 0892135f4597d3c52959d5e8b98e94e1e2649d67 1 parent 2ffcfb9
@fabpot fabpot authored
View
2  src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php
@@ -56,11 +56,13 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ
try {
$response = parent::handle($request, $type, $catch);
} catch (\Exception $e) {
+ $this->container->set('request', null, 'request');
$this->container->leaveScope('request');
throw $e;
}
+ $this->container->set('request', null, 'request');
$this->container->leaveScope('request');
return $response;
View
16 src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ContainerAwareHttpKernelTest.php
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Component\HttpKernel\Tests;
+namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel;
@@ -54,10 +54,15 @@ public function testHandle($type)
->with($this->equalTo('request'))
;
$container
- ->expects($this->once())
+ ->expects($this->at(1))
->method('set')
->with($this->equalTo('request'), $this->equalTo($request), $this->equalTo('request'))
;
+ $container
+ ->expects($this->at(2))
+ ->method('set')
+ ->with($this->equalTo('request'), $this->equalTo(null), $this->equalTo('request'))
+ ;
$dispatcher = new EventDispatcher();
$resolver = $this->getMock('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface');
@@ -101,10 +106,15 @@ public function testHandleRestoresThePreviousRequestOnException($type)
->with($this->equalTo('request'))
;
$container
- ->expects($this->once())
+ ->expects($this->at(1))
->method('set')
->with($this->equalTo('request'), $this->equalTo($request), $this->equalTo('request'))
;
+ $container
+ ->expects($this->at(2))
+ ->method('set')
+ ->with($this->equalTo('request'), $this->equalTo(null), $this->equalTo('request'))
+ ;
$dispatcher = new EventDispatcher();
$resolver = $this->getMock('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface');
Please sign in to comment.
Something went wrong with that request. Please try again.