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

PCRE2 Matching error introduced in 7.4.7 #7994

Closed
ghost opened this issue Jan 23, 2022 · 3 comments
Closed

PCRE2 Matching error introduced in 7.4.7 #7994

ghost opened this issue Jan 23, 2022 · 3 comments

Comments

@ghost
Copy link

ghost commented Jan 23, 2022

Description

Starting with PHP 7.4.7 PCRE2 {x} no longer matches but {x-1,x+1} does. For a more full explanation see this bug off another project where the project owner was like "upstream and here is proof, go file with PHP" so here I am :)

basically with the string "aa" [a]{1,3} matches but [a]{2} does not as of PHP 7.4.7.

firasdib/Regex101#1704 (comment)

PHP Version

PHP 7.4.7

Operating System

No idea, whatever Tenable Security Center runs.

@iluuu1994
Copy link
Member

Minimal example to reproduce the problem:

https://3v4l.org/YmfGg

var_dump(preg_match('~[Aa]{2}~', 'aa'));

Output for 7.4.6 - 7.4.27, 8.0.1 - 8.0.15, 8.1.0 - 8.1.2
int(0)

Output for 7.4.0 - 7.4.5
int(1)

However, we're not maintaining the PCRE2 library, we're just using it. So the correct place to raise the issue would probably be here:
https://github.com/PhilipHazel/pcre2/issues

@damianwadley
Copy link
Member

PHP is currently on PCRE2 10.39, which is the latest version. 3v4l says the problem started in 7.4.6 which corresponds to PCRE2 10.34, and looking through the changelog I do see a handful of changes regarding single-character repetition between then and now.

Bug aside, that regex makes my eyes bleed.

@ghost
Copy link
Author

ghost commented Jan 24, 2022

Just an aside at @damianwadley as I feel his pain, yeah Tenable Security Center doesn't allow case insensitivity for it's PCRE asset matching and sys admins can't be counted on to consistently case DNS A records so it leads to nightmares like that lol. I got hundreds of similar ones, some even more atrocious.

And yes I have literally seen in my zone file (even right now): Server1, server2, SERVER3, SeRvEr4, SerVer5 ...

Just empathizing at the eye cancer lol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants