Skip to content

Commit

Permalink
frankenphp-symfony: tiny refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Oct 30, 2023
1 parent 088a56f commit 667a22c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/frankenphp-symfony/src/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,24 @@ public function __construct(private HttpKernelInterface $kernel)

public function run(): int
{
$kernel = $this->kernel;
$server = array_filter($_SERVER, static fn (string $key) => !str_starts_with($key, 'HTTP_'), ARRAY_FILTER_USE_KEY);
$server['APP_RUNTIME_MODE'] = 'web=1&worker=1';

$handler = static function () use ($kernel, $server, &$sfRequest, &$sfResponse): void {
// Merge the environment variables coming from DotEnv with the ones tied to the current request
$handler = function () use ($server, &$sfRequest, &$sfResponse): void {
// Merge the environment variables coming from DotEnv with the ones tight to the current request
$_SERVER += $server;

$sfRequest = Request::createFromGlobals();
$sfResponse = $kernel->handle($sfRequest);
$sfResponse = $this->kernel->handle($sfRequest);

$sfResponse->send();
};

do {
$ret = \frankenphp_handle_request($handler);

if ($kernel instanceof TerminableInterface && $sfRequest && $sfResponse) {
$kernel->terminate($sfRequest, $sfResponse);
if ($this->kernel instanceof TerminableInterface && $sfRequest && $sfResponse) {
$this->kernel->terminate($sfRequest, $sfResponse);
}

gc_collect_cycles();
Expand Down

0 comments on commit 667a22c

Please # to comment.