Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[ErrorHandler] Fix rendered exception code highlighting on PHP 8.3 #57355

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 15, 2024

Conversation

tscni
Copy link
Contributor

@tscni tscni commented Jun 9, 2024

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #57354
License MIT

#51586 made some mistakes when fixing the use of highlight_file() for PHP 8.3:

  • It assumed that the inner <span> were changed to <code>
  • It did not properly adjust the pattern for \n when splitting the highlighting across multiple lines
  • It replaced all spaces with &nbsp, including those inside tags, breaking the highlighting entirely

The first two are easy to fix.

The latter one not so much without CSS adjustments. But just changing white-space: nowrap to white-space: pre would remove the need for that. I'm a bit worried about side effects though and I'm not sure if CodeExtension uses separate styling somewhere, but I can't find anything problematic at least.

A test would be a bit cumbersome to add for this, so unless very much preferred I'd rather not spend the time on it.
But at least in manual tests this resolved all the highlighting issues.

@fabpot
Copy link
Member

fabpot commented Jun 15, 2024

Thank you @tscni.

@fabpot fabpot merged commit f2d95c4 into symfony:5.4 Jun 15, 2024
9 of 12 checks passed
@tscni tscni deleted the fix/error-handler-code-highlighting branch June 16, 2024 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants