Skip to content

Commit

Permalink
[HttpKernel] Add parameters kernel.runtime_mode and `kernel.runtime…
Browse files Browse the repository at this point in the history
…_mode.*`, all set from env var `APP_RUNTIME_MODE`
  • Loading branch information
nicolas-grekas committed Oct 18, 2023
1 parent 87e0d10 commit 86901b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Resources/functions/dump.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function dump(mixed ...$vars): mixed
if (!function_exists('dd')) {
function dd(mixed ...$vars): never
{
if (!in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && !headers_sent()) {
if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) && !headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}

Expand Down
6 changes: 3 additions & 3 deletions VarDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ private static function register(): void
case 'server' === $format:
case $format && 'tcp' === parse_url($format, \PHP_URL_SCHEME):
$host = 'server' === $format ? $_SERVER['VAR_DUMPER_SERVER'] ?? '127.0.0.1:9912' : $format;
$dumper = \in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) ? new CliDumper() : new HtmlDumper();
$dumper = \in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) ? new CliDumper() : new HtmlDumper();
$dumper = new ServerDumper($host, $dumper, self::getDefaultContextProviders());
break;
default:
$dumper = \in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) ? new CliDumper() : new HtmlDumper();
$dumper = \in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) ? new CliDumper() : new HtmlDumper();
}

if (!$dumper instanceof ServerDumper) {
Expand All @@ -111,7 +111,7 @@ private static function getDefaultContextProviders(): array
{
$contextProviders = [];

if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && class_exists(Request::class)) {
if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) && class_exists(Request::class)) {
$requestStack = new RequestStack();
$requestStack->push(Request::createFromGlobals());
$contextProviders['request'] = new RequestContextProvider($requestStack);
Expand Down

0 comments on commit 86901b1

Please sign in to comment.