diff --git a/src/Symfony/Bundle/FrameworkBundle/Client.php b/src/Symfony/Bundle/FrameworkBundle/Client.php index 52efc80619ad..ff7cde9f4309 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Client.php +++ b/src/Symfony/Bundle/FrameworkBundle/Client.php @@ -156,7 +156,7 @@ protected function getScript($request) $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 16188857151a..2d7f2c7ab753 100644 --- a/src/Symfony/Component/HttpKernel/Client.php +++ b/src/Symfony/Component/HttpKernel/Client.php @@ -84,7 +84,7 @@ protected function getScript($request) $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; }