From 8c8cf620382fed360d42c8d7a29609895dc70413 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 29 Sep 2013 21:03:21 +0200 Subject: [PATCH] fixed Client when using the terminable event --- src/Symfony/Bundle/FrameworkBundle/Client.php | 7 +++++-- src/Symfony/Component/HttpKernel/Client.php | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Client.php b/src/Symfony/Bundle/FrameworkBundle/Client.php index 52efc80619..ff7cde9f43 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Client.php +++ b/src/Symfony/Bundle/FrameworkBundle/Client.php @@ -156,7 +156,7 @@ class Client extends BaseClient $profilerCode = '$kernel->getContainer()->get(\'profiler\')->enable();'; } - return <<boot(); $profilerCode -echo serialize(\$kernel->handle(unserialize('$request'))); + +\$request = unserialize('$request'); EOF; + + return $code.$this->getHandleScript(); } } diff --git a/src/Symfony/Component/HttpKernel/Client.php b/src/Symfony/Component/HttpKernel/Client.php index 1618885715..2d7f2c7ab7 100644 --- a/src/Symfony/Component/HttpKernel/Client.php +++ b/src/Symfony/Component/HttpKernel/Client.php @@ -84,7 +84,7 @@ class Client extends BaseClient $requirePath = str_replace("'", "\\'", $r->getFileName()); $symfonyPath = str_replace("'", "\\'", realpath(__DIR__.'/../../..')); - return <<register(); \$kernel = unserialize('$kernel'); -echo serialize(\$kernel->handle(unserialize('$request'))); +\$request = unserialize('$request'); +EOF; + + return $code.$this->getHandleScript(); + } + + protected function getHandleScript() + { + return <<<'EOF' +$response = $kernel->handle($request); + +if ($kernel instanceof Symfony\Component\HttpKernel\TerminableInterface) { + $kernel->terminate($request, $response); +} + +echo serialize($response); EOF; }