fix: detect Symfony 7.4+ exception pages - #197
Merged
Merged
Conversation
7.4 renders exceptions with `var-dumper` instead of the html trace page, so the css selectors matched nothing and `ensureNoException()` returned early.
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.
Session::ensureNoException()scraped the exception page with.trace-details .trace-classand.exception-message-wrapper .exception-message. Symfony 7.4 renders exceptions withvar-dumperinstead, and under the CLI SAPI that output isn't even html:Both selectors matched nothing, so the method returned early and
fails_if_trying_to_manipulate_exception_pagecould only be marked incomplete on 7.4+. The old path is kept for < 7.4, the dump format is now recognised alongside it, and the guard on the test is gone.The status check moved to the top as a side effect: an exception page always carries a 4xx/5xx, and this runs before every action and assertion, so successful responses are no longer inspected at all. It falls through when a driver cannot report a status (Panther throws), preserving the old behaviour there.
Verified on Symfony 8.1.4 and 6.4.43 — the test passes with 12 assertions on each.