Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[ErrorHandler] Handle PHP 8.3highlight_file function output changes#51586

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

Merged

Conversation

@PhilETaylor
Copy link
Contributor

@PhilETaylorPhilETaylor commentedSep 6, 2023
edited
Loading

QA
Branch?5.4
Bug fix?PHP 8.3 Compatibility
New feature?no
Deprecations?no
LicenseMIT

PHP 8.3 changes the output from thehighlight_file function as described here:https://php.watch/versions/8.3/highlight_file-highlight_string-html-changes

I accidentally ran into this head first when using PHP 8.3.0-RC1 in development with Symfony 6.4-dev when my error had no code rendered

Also affected the{{ '/path/to/file.html.twig'|file_excerpt(140,5) }} twig code file_except renderer - easier to replicate with that code just throw it into your twig file with a valid/path/to/file.html.twig - before this PR there would be no output, after this PR the file except would be shown.

Same fix applied to both files.

ScreenShot-2023-09-06-21 42 56

After this fix the code rendered returned.

ScreenShot-2023-09-06-21 29 54

@derrabus
Copy link
Member

Thank you. Does this affect 5.4 or 6.3 as well? If that's the case, please retarget your PR.

@PhilETaylor
Copy link
ContributorAuthor

looks like it needs to be 5.4.

derrabus reacted with thumbs up emoji

@PhilETaylorPhilETaylor changed the base branch from6.4 to5.4September 6, 2023 21:40
@PhilETaylorPhilETaylor changed the base branch from5.4 to6.4September 6, 2023 21:41
@PhilETaylorPhilETaylorforce-pushed thephp8errorrenderhighlightfile branch fromad10b00 to5f260a3CompareSeptember 6, 2023 21:45
@PhilETaylorPhilETaylor changed the base branch from6.4 to5.4September 6, 2023 21:45
@PhilETaylorPhilETaylorforce-pushed thephp8errorrenderhighlightfile branch from5f260a3 tob4190dbCompareSeptember 6, 2023 21:51
@derrabusderrabus modified the milestones:6.4,5.4Sep 6, 2023
@PhilETaylorPhilETaylorforce-pushed thephp8errorrenderhighlightfile branch fromb4190db to809cf74CompareSeptember 6, 2023 21:54
@PhilETaylor
Copy link
ContributorAuthor

its late and my eyes sleepy, but I think Ive downgraded it ok, and removed short function syntax in my original to be compatible with PHP 7 also. Should be ok to test now.

derrabus, OskarStark, and javiereguiluz reacted with rocket emoji

Copy link
Member

@javiereguiluzjaviereguiluz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It's very important to update Symfony for this BC-break in PHP 8.3. Thanks Phil for taking care of this!

@nicolas-grekas
Copy link
Member

Thank you@PhilETaylor.

@nicolas-grekasnicolas-grekas merged commit0da9599 intosymfony:5.4Sep 11, 2023
This was referencedSep 30, 2023
fabpot added a commit that referenced this pull requestJun 15, 2024
… PHP 8.3 (tscni)This PR was merged into the 5.4 branch.Discussion----------[ErrorHandler] Fix rendered exception code highlighting on PHP 8.3| 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 entirelyThe 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.Commits-------2b46e2a [ErrorHandler] Fix rendered exception code highlighting on PHP 8.3
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz approved these changes

@lyrixxlyrixxlyrixx approved these changes

@stofstofstof approved these changes

@ycerutoycerutoAwaiting requested review from ycerutoyceruto is a code owner

@chalasrchalasrAwaiting requested review from chalasr

@dunglasdunglasAwaiting requested review from dunglas

@OskarStarkOskarStarkAwaiting requested review from OskarStark

@xabbuhxabbuhAwaiting requested review from xabbuh

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

7 participants

@PhilETaylor@derrabus@nicolas-grekas@javiereguiluz@lyrixx@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp