Skip to content

Commit ecb9358

Browse files
VincentLangletfabpot
authored andcommitted
[Runtime] Support runtime options as a string
1 parent 3ab58a4 commit ecb9358

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Symfony/Component/Runtime/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
7.4
55
---
66

7+
* Add JSON encoded value support for `APP_RUNTIME_OPTIONS`
78
* Add `FrankenPhpWorkerRunner`
89
* Add automatic detection of FrankenPHP worker mode in `SymfonyRuntime`
910

src/Symfony/Component/Runtime/Internal/autoload_runtime.template

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ if (!is_object($app)) {
1212
throw new TypeError(sprintf('Invalid return value: callable object expected, "%s" returned from "%s".', get_debug_type($app), $_SERVER['SCRIPT_FILENAME']));
1313
}
1414

15+
if (is_string($_SERVER['APP_RUNTIME_OPTIONS'] ??= $_ENV['APP_RUNTIME_OPTIONS'] ?? [])) {
16+
$_SERVER['APP_RUNTIME_OPTIONS'] = json_decode($_SERVER['APP_RUNTIME_OPTIONS'], true, 512, JSON_THROW_ON_ERROR);
17+
}
1518
$runtime = $_SERVER['APP_RUNTIME'] ?? $_ENV['APP_RUNTIME'] ?? %runtime_class%;
16-
$runtime = new $runtime(($_SERVER['APP_RUNTIME_OPTIONS'] ?? $_ENV['APP_RUNTIME_OPTIONS'] ?? []) + %runtime_options%);
19+
$runtime = new $runtime($_SERVER['APP_RUNTIME_OPTIONS'] += %runtime_options%);
1720

1821
[$app, $args] = $runtime
1922
->getResolver($app)

0 commit comments

Comments
 (0)