fix(symfony): log the ErrorListener diagnostic at debug level - #8433
Open
davidmpaz wants to merge 1 commit into
Open
fix(symfony): log the ErrorListener diagnostic at debug level#8433davidmpaz wants to merge 1 commit into
davidmpaz wants to merge 1 commit into
Conversation
The message announcing that an exception is being transformed into an Error resource describes normal operation and is already gated behind $debug, but it was emitted at `error` level. Without Monolog, Symfony falls back to its stderr logger, and the phpunit recipe ships SHELL_VERBOSITY=-1, which sets that logger's threshold to exactly `error`. Any functional test asserting a 4xx therefore prints the line in an otherwise green suite, where it reads as a failure. Closes api-platform#8432
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
ErrorListener::duplicateRequest()to log its diagnostic atdebuglevel instead oferror.The message announces that the listener is converting an exception into an
Errorresource — normal operation, not a fault — and the call is already gated behind$this->debug.The practical effect: without Monolog, Symfony falls back to
HttpKernel\Log\Logger, and thephpunit/phpunitrecipe insymfony/recipesshipsSHELL_VERBOSITY=-1, which sets that logger's threshold to exactlyerror. So any functional test asserting a 4xx prints the line in the middle of an otherwise green suite:which reads as a failure. It is also unreachable by
framework.exceptions[].log_level, Symfony's own mechanism for reclassifying client errors, because the level is hardcoded here.Test
testDiagnosticIsLoggedAtDebugLevelassertsdebug()is called anderror()is not. I verified it fails against the unpatched listener:and passes with it.
src/Symfony/Tests/EventListener/ErrorListenerTest.phpis green (5 tests, 34 assertions).Notes
$this->debugguard are unchanged, only the severity.php-cs-fixerreports nothing to fix on either file.src/Symfony/Testssuite, one unrelated failure remains inApiPlatformExtensionTest(api_platform.swagger_ui.processor). I confirmed it is pre-existing by re-running it on a pristine4.3checkout with my changes stashed.occured→occurredtypo alone to keep this to a single concern. Happy to add it here or in a separate PR, whichever you prefer.