Closed andrii-pukhalevych closed 2 years ago
Shouldn't we skip using ErrorHandlerMiddleware in cli mode?
Probably, but the middleware changing the exception renderer is unexpected to me. Let me try and reproduce this.
Are you running into incorrect output in a command that you're writing, or is it another scenario? Do you have any tips or code on how I could reproduce the issue you're encountering.
Seems I got this on some old app that didn't use regular way of console commands.
Instead, it accepts URL in command line - it was done to run app from both console and browser.
In webroot/index.php
it has
if (PHP_SAPI === 'cli') {
$_SERVER['PHP_SELF'] = '/' . basename(__FILE__);
$_SERVER['REQUEST_URI'] = $argv[1] ?? null;
}
and then
$response = $server->run();
if (PHP_SAPI === 'cli') {
echo $response->getBody();
} else {
$server->emit($response);
}
This is a (multiple allowed):
[ ] bug
[x] enhancement
[ ] feature-discussion (RFC)
CakePHP Application Skeleton Version: 4.4.2.
Using
ErrorHandlerMiddleware
incli
mode seems to be not fully correct. It causes using ofWebExceptionRenderer
incli
mode. In case of specifyingConsoleErrorRenderer
in app config it blocks output tostderror
.Shouldn't we skip using
ErrorHandlerMiddleware
incli
mode?