-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed as not planned
Labels
Description
Hi,
PHP 7.3 migrated from PCRE to PCRE2 . PCRE2 is stricter and requires escaping of hiphens in regular expressions. This is not detected by PHPCS. If this makes sense to you, could it be possible to add a test for hiphens and other characters that need to be escaped so that the following sample would raise a REGEXP warning when running phpcs?
<?php
$tag="j";
if (preg_match("/^[\w-:]+$/", $tag)) {
print "match";
} else {
print "no match";
}
PHP 7.3 on the above code gives:
Warning: preg_match(): Compilation failed: invalid range in character class at offset 4 in /usr/local/src/test.php3 on line 5
Thanks!
Reactions are currently unavailable