Skip to content

Commit 5e9ba51

Browse files
allow for more graceful migration - don't err on now ignored X modifier
1 parent f66ea6e commit 5e9ba51

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

UPGRADING

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ PHP 8.0 UPGRADE NOTES
147147

148148
- PCRE:
149149
. When passing invalid escape sequences they are no longer intepreted as
150-
literals. This behaviour previously required the X modifier - which has
151-
been removed as well.
150+
literals. This behaviour previously required the X modifier - which is
151+
now ignored.
152152

153153
- PDO:
154154
. The method PDOStatement::setFetchMode() now accepts the following signature:

ext/pcre/php_pcre.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
694694
case 'A': coptions |= PCRE2_ANCHORED; break;
695695
case 'D': coptions |= PCRE2_DOLLAR_ENDONLY;break;
696696
case 'S': /* Pass. */ break;
697+
case 'X': /* Pass. */ break;
697698
case 'U': coptions |= PCRE2_UNGREEDY; break;
698699
case 'u': coptions |= PCRE2_UTF;
699700
/* In PCRE, by default, \d, \D, \s, \S, \w, and \W recognize only ASCII

ext/pcre/tests/pcre_extra.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
X (PCRE_EXTRA) modififier is no longer functional
2+
X (PCRE_EXTRA) modififier is ignored (no error, no change)
33
--FILE--
44
<?php
55

@@ -11,5 +11,5 @@ var_dump(preg_match('/\y/X', '\y'));
1111
Warning: preg_match(): Compilation failed: unrecognized character follows \ at offset 1 in %spcre_extra.php on line 3
1212
bool(false)
1313

14-
Warning: preg_match(): Unknown modifier 'X' in %spcre_extra.php on line 4
14+
Warning: preg_match(): Compilation failed: unrecognized character follows \ at offset 1 in %spcre_extra.php on line 4
1515
bool(false)

0 commit comments

Comments
 (0)