PCRE2 Matching error introduced in 7.4.7
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.
https://github.com/firasdib/Regex101/issues/1704#issuecomment-1019503942
PHP Version
PHP 7.4.7
Operating System
No idea, whatever Tenable Security Center runs.
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
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.
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.