Skip to content

Commit

Permalink
fixed Client when using the terminable event
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Sep 29, 2013
1 parent a46ff2f commit 8c8cf62
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/Symfony/Bundle/FrameworkBundle/Client.php
Expand Up @@ -156,7 +156,7 @@ protected function getScript($request)
$profilerCode = '$kernel->getContainer()->get(\'profiler\')->enable();';
}

return <<<EOF
$code = <<<EOF
<?php
if ('$autoloader') {
Expand All @@ -167,7 +167,10 @@ protected function getScript($request)
\$kernel = unserialize('$kernel');
\$kernel->boot();
$profilerCode
echo serialize(\$kernel->handle(unserialize('$request')));
\$request = unserialize('$request');
EOF;

return $code.$this->getHandleScript();
}
}
19 changes: 17 additions & 2 deletions src/Symfony/Component/HttpKernel/Client.php
Expand Up @@ -84,7 +84,7 @@ protected function getScript($request)
$requirePath = str_replace("'", "\\'", $r->getFileName());
$symfonyPath = str_replace("'", "\\'", realpath(__DIR__.'/../../..'));

return <<<EOF
$code = <<<EOF
<?php
require_once '$requirePath';
Expand All @@ -94,7 +94,22 @@ protected function getScript($request)
\$loader->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;
}

Expand Down

0 comments on commit 8c8cf62

Please sign in to comment.