-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HttpKernel] Add parameters kernel.runtime_mode
and kernel.runtime_mode.*
, all set from env var APP_RUNTIME_MODE
#52079
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -340,7 +340,7 @@ class %s extends {$options['class']} | |
|
||
use Symfony\Component\DependencyInjection\Dumper\Preloader; | ||
|
||
if (in_array(PHP_SAPI, ['cli', 'phpdbg'], true)) { | ||
if (in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) { | ||
return; | ||
} | ||
|
||
|
@@ -388,6 +388,7 @@ class %s extends {$options['class']} | |
'container.build_hash' => '$hash', | ||
'container.build_id' => '$id', | ||
'container.build_time' => $time, | ||
'container.runtime_mode' => \\in_array(\\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) ? 'web=0' : 'web=1', | ||
], __DIR__.\\DIRECTORY_SEPARATOR.'Container{$hash}'); | ||
|
||
EOF; | ||
|
@@ -1591,7 +1592,7 @@ private function addDefaultParametersMethod(): string | |
$export = $this->exportParameters([$value], '', 12, $hasEnum); | ||
$export = explode('0 => ', substr(rtrim($export, " ]\n"), 2, -1), 2); | ||
|
||
if ($hasEnum || preg_match("/\\\$container->(?:getEnv\('(?:[-.\w\\\\]*+:)*+\w++'\)|targetDir\.'')/", $export[1])) { | ||
if ($hasEnum || preg_match("/\\\$container->(?:getEnv\('(?:[-.\w\\\\]*+:)*+\w*+'\)|targetDir\.'')/", $export[1])) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this change allows to derivate dynamic parameters from other ones, eg |
||
$dynamicPhp[$key] = sprintf('%s%s => %s,', $export[0], $this->export($key), $export[1]); | ||
$this->dynamicParameters[$key] = true; | ||
} else { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,9 @@ | |
namespace Symfony\Component\Runtime\Runner\Symfony; | ||
|
||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\HttpKernel\HttpKernelInterface; | ||
use Symfony\Component\HttpKernel\Kernel; | ||
use Symfony\Component\HttpKernel\TerminableInterface; | ||
use Symfony\Component\Runtime\RunnerInterface; | ||
|
||
|
@@ -31,7 +33,21 @@ public function __construct( | |
public function run(): int | ||
{ | ||
$response = $this->kernel->handle($this->request); | ||
$response->send(!$this->debug); | ||
|
||
if (Kernel::VERSION_ID >= 60400) { | ||
$response->send(false); | ||
|
||
if (\function_exists('fastcgi_finish_request') && !$this->debug) { | ||
fastcgi_finish_request(); | ||
} elseif (\function_exists('litespeed_finish_request') && !$this->debug) { | ||
litespeed_finish_request(); | ||
} else { | ||
Response::closeOutputBuffers(0, true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unlike the logic in |
||
flush(); | ||
} | ||
} else { | ||
$response->send(); | ||
} | ||
|
||
if ($this->kernel instanceof TerminableInterface) { | ||
$this->kernel->terminate($this->request, $response); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aligning with other checks we have in place for APCu (not need to enable it for phpdbg/embed)