Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[HttpKernel] Add parameterskernel.runtime_mode andkernel.runtime_mode.*, all set from env varAPP_RUNTIME_MODE#52079
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
5e777ad to1387951CompareUh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
1387951 to9cb05e6Compare9cb05e6 to54ed084Comparestof commentedOct 17, 2023
shouldn't the error rendering depend on web_mode ? For a long-running server, we would want to provide the web error rendering. |
Uh oh!
There was an error while loading.Please reload this page.
nicolas-grekas commentedOct 17, 2023
yes, but it's too much work for me for now, could be handled later on (same for cache locking, see PR description) |
kernel.runtime_mode, defined as%env(default:container.runtime_mode:APP_RUNTIME_MODE)%kernel.runtime_mode andkernel.runtime_mode.*, all set from env varAPP_RUNTIME_MODE54ed084 toaaafad1Comparenicolas-grekas commentedOct 18, 2023
PR updated. No special service anymore, only parameters. Here is the new description: Here, we ensure that the kernel always provides a new This also creates 3 new parameters that should be the most common: A long-running server would typically set |
| } | ||
| if (\in_array(\PHP_SAPI, ['cli','phpdbg'],true) && !filter_var(\ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOL)) { | ||
| if ('cli' === \PHP_SAPI && !filter_var(\ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOL)) { |
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)
| $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 comment
The reason will be displayed to describe this comment to others.Learn more.
this change allows to derivate dynamic parameters from other ones, eg%env(key:foo:default:bar:)% extracts keyfoo from parameterbar (which is supposed to be an array here)
…_mode.*`, all set from env var `APP_RUNTIME_MODE`
aaafad1 to7c70aecCompare| }elseif (\function_exists('litespeed_finish_request') && !$this->debug) { | ||
| litespeed_finish_request(); | ||
| }else { | ||
| Response::closeOutputBuffers(0,true); |
nicolas-grekasOct 18, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
Unlike the logic in$response->send(), we call this unconditionally. The reason is that here, in the runtime, we know we want to flush whatever the SAPI.
fabpot commentedOct 20, 2023
Thank you@nicolas-grekas. |
…t (HypeMC)This PR was merged into the 6.4 branch.Discussion----------[DebugBundle] Wire `DumpDataCollector`'s `webMode` argument| Q | A| ------------- | ---| Branch? | 6.4| Bug fix? | maybe| New feature? | no| Deprecations? | no| Issues | -| License | MITI've noticed that the `DumpDataCollector::$webMode` that was added in#52079 was never wired. I'm not sure if this was intentional or an oversight.Commits-------7644e9d [DebugBundle] Wire `DumpDataCollector`'s `webMode` argument
Uh oh!
There was an error while loading.Please reload this page.
Alternative to#51408. I think this approach is simpler and more powerful.
Here, we ensure that the kernel always provides a new
kernel.runtime_modeparameter. This parameter is an array derived by default from theAPP_RUNTIME_MODEenv var, using thequery_stringprocessor.This also creates 3 new parameters that should be the most common:
kernel.runtime_mode.web,kernel.runtime_mode.cli, andkernel.runtime_mode.worker.A long-running server would typically set
APP_RUNTIME_MODEtoweb=1&worker=1orweb=0&worker=1when appropriate (eghttps://github.com/php-runtime/frankenphp-symfony/ should do so whenFRANKENPHP_WORKERis set.)I screened the codebase and updated them all except cache pools (where the SAPI is used to enable/disable locking) and error renderers (where the SAPI is used to turn html-rendering on/off.) These require more work that could be done later on. There are a few other remaining usages of
PHP_SAPIbut these look not appropriate for the new flag.