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

[Routing] Enhance error handling in StaticPrefixCollection for compatibility with libpcre2-10.43 #54080

Merged
merged 1 commit into from Feb 27, 2024

Conversation

Lustmored
Copy link
Contributor

The error handling function in the StaticPrefixCollection class has been extended. A new check for 'Compilation failed: length of lookbehind assertion is not limited' message error was added to improve the error capture process.

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

Recent changes in libpcre2 have changed the error message we are trying to catch in StaticPrefixCollection. The change comes from this commit (please take a look at changes in src/pcre2_error.c):

PCRE2Project/pcre2@1e78b77

This PR checks for both possible error messages for backwards-compatible way of handling errors.

I did not add any tests as current tests are throwing PHP warnings when run with newer libpcre2, which are gone after the proposed change and I'm unsure how to proceed with that fact.

…th libpcre2-10.43

The error handling function in the StaticPrefixCollection class has been extended. A new check for 'Compilation failed: length of lookbehind assertion is not limited' message error was added to improve the error capture process.
@carsonbot carsonbot added this to the 5.4 milestone Feb 27, 2024
@carsonbot carsonbot changed the title Enhance error handling in StaticPrefixCollection for compatibility with libpcre2-10.43 [Routing] Enhance error handling in StaticPrefixCollection for compatibility with libpcre2-10.43 Feb 27, 2024
Copy link
Member

@derrabus derrabus left a comment

Choose a reason for hiding this comment

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

Good catch!

The affected PCRE2 version has been released two weeks ago and it will probably take a while until our CI will pick it up.

I've installed PCRE2 10.43 locally and ran our Routing test suite. I can confirm that our tests trigger the warning you've described and that your change fixes that warning.

@derrabus
Copy link
Member

Good catch, thanks @Lustmored.

@derrabus derrabus merged commit dc1da9c into symfony:5.4 Feb 27, 2024
11 checks passed
@Lustmored Lustmored deleted the libpcre2-10.43 branch February 27, 2024 12:33
@PhilETaylor
Copy link
Contributor

hmmm... something broke. Im running 6.4.x and when this was upmerged, now when I run a cache clear in my project I get

ScreenShot-2024-03-04-13 00 10

AMA.

@Lustmored
Copy link
Contributor Author

@PhilETaylor Are you able to determine version of libpcre2 on the system where it occurs? The message you are getting is different from whatever I have found to be on previous or new versions

@PhilETaylor
Copy link
Contributor

hmmm ignore me, this PR actually FIXES the problem I have, I checked src/Symfony/Component/Routing/Matcher/Dumper/StaticPrefixCollection.php and this PR had not been applied to it, and when I manually apply the change the error disappears - sorry for the noise, all good...

@PhilETaylor
Copy link
Contributor

pcre

PCRE (Perl Compatible Regular Expressions) Support => enabled
PCRE Library Version => 10.43 2024-02-16
PCRE Unicode Version => 15.0.0
PCRE JIT Support => enabled
PCRE JIT Target => ARM-64 64bit (little endian + unaligned)

Before this PR I get the error - with this PR applied (using 6.4.x-dev - Upgrading symfony/routing (v6.4.3 => 6.4.x-dev 7fe3006): Extracting archive) there is no error.

Sorry for the noise.

@derrabus
Copy link
Member

derrabus commented Mar 4, 2024

I think, the PCRE2 10.43 update was merged today or yesterday into Homebrew. So if that's what you're using to manage PHP on that machine, that's probably the reason why the problem appeared for you today.

But that also means that more people on Macs might be hitting this issue soon. And we're still about four weeks away from the next bugfix releases. 😓

@PhilETaylor
Copy link
Contributor

Yeah I update everything daily - including brew and composer deps and deploy daily

for me personally it’s not an issue as I can use the dev versions and also I use docker containers for production builds, but your comments on homebrew might help others coming and reading this.

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

5 participants