Skip to content
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

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

Merged

Conversation

PhilETaylor
Copy link
Contributor

@PhilETaylor PhilETaylor commented Sep 6, 2023

Q A
Branch? 5.4
Bug fix? PHP 8.3 Compatibility
New feature? no
Deprecations? no
License MIT

PHP 8.3 changes the output from the highlight_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

derrabus commented Sep 6, 2023

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

@PhilETaylor
Copy link
Contributor Author

looks like it needs to be 5.4.

@PhilETaylor PhilETaylor changed the base branch from 6.4 to 5.4 September 6, 2023 21:40
@PhilETaylor PhilETaylor changed the base branch from 5.4 to 6.4 September 6, 2023 21:41
@PhilETaylor PhilETaylor changed the base branch from 6.4 to 5.4 September 6, 2023 21:45
@derrabus derrabus modified the milestones: 6.4, 5.4 Sep 6, 2023
@PhilETaylor
Copy link
Contributor Author

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.

Copy link
Member

@javiereguiluz javiereguiluz 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-grekas nicolas-grekas merged commit 0da9599 into symfony:5.4 Sep 11, 2023
9 of 11 checks passed
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.

None yet

7 participants