Fix external pcre2 build (#13662)

PCRE2_EXTRA_CASELESS_RESTRICT is only available as of pcre2 10.43.
Note: no check is necessary for pcre2_set_compile_extra_options because
it is available since pcre2 10.30, which is the minimum version PHP
requires.
This commit is contained in:
Niels Dossche 2024-03-10 13:15:15 +01:00 committed by GitHub
parent cfdbf7743d
commit d0e15c8502
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View file

@ -723,7 +723,9 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, bo
/* PCRE specific options */ /* PCRE specific options */
case 'A': coptions |= PCRE2_ANCHORED; break; case 'A': coptions |= PCRE2_ANCHORED; break;
case 'D': coptions |= PCRE2_DOLLAR_ENDONLY;break; case 'D': coptions |= PCRE2_DOLLAR_ENDONLY;break;
#ifdef PCRE2_EXTRA_CASELESS_RESTRICT
case 'r': eoptions |= PCRE2_EXTRA_CASELESS_RESTRICT; break; case 'r': eoptions |= PCRE2_EXTRA_CASELESS_RESTRICT; break;
#endif
case 'S': /* Pass. */ break; case 'S': /* Pass. */ break;
case 'X': /* Pass. */ break; case 'X': /* Pass. */ break;
case 'U': coptions |= PCRE2_UNGREEDY; break; case 'U': coptions |= PCRE2_UNGREEDY; break;

View file

@ -1,5 +1,11 @@
--TEST-- --TEST--
testing /r modifier in preg_* functions testing /r modifier in preg_* functions
--SKIPIF--
<?php
if (PCRE_VERSION_MAJOR == 10 && PCRE_VERSION_MINOR < 43) {
die("skip old pcre version");
}
?>
--FILE-- --FILE--
<?php <?php
echo "SK substitute matching" . PHP_EOL; echo "SK substitute matching" . PHP_EOL;