diff --git a/UPGRADING b/UPGRADING index 6d06234403d66..3af7c267be9df 100644 --- a/UPGRADING +++ b/UPGRADING @@ -42,6 +42,11 @@ PHP 8.5 UPGRADE NOTES have run and the output handlers have been cleaned up. This is a consequence of fixing GH-18033. +- PCRE: + . The extension is compiled without semi-deprecated + PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK compile option. + https://github.com/PCRE2Project/pcre2/issues/736#issuecomment-2754024651 + - Intl: . The extension now requires at least ICU 57.1. diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index a2a577a6745a0..8e0fb2cce5f9b 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -199,13 +199,6 @@ static void php_pcre_efree(void *block, void *data) efree(block); } -#ifdef PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK - /* pcre 10.38 needs PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK, disabled by default */ -#define PHP_PCRE_DEFAULT_EXTRA_COPTIONS PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK -#else -#define PHP_PCRE_DEFAULT_EXTRA_COPTIONS 0 -#endif - #define PHP_PCRE_PREALLOC_MDATA_SIZE 32 static void php_pcre_init_pcre2(uint8_t jit) @@ -226,8 +219,6 @@ static void php_pcre_init_pcre2(uint8_t jit) } } - pcre2_set_compile_extra_options(cctx, PHP_PCRE_DEFAULT_EXTRA_COPTIONS); - if (!mctx) { mctx = pcre2_match_context_create(gctx); if (!mctx) { @@ -590,7 +581,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, bo #else uint32_t coptions = 0; #endif - uint32_t eoptions = PHP_PCRE_DEFAULT_EXTRA_COPTIONS; + uint32_t eoptions = 0; PCRE2_UCHAR error[128]; PCRE2_SIZE erroffset; int errnumber; diff --git a/ext/pcre/tests/bug70345.phpt b/ext/pcre/tests/bug70345.phpt index 42d4f8b12e265..bdfa2041fc08a 100644 --- a/ext/pcre/tests/bug70345.phpt +++ b/ext/pcre/tests/bug70345.phpt @@ -1,5 +1,10 @@ --TEST-- Bug #70345 (Multiple vulnerabilities related to PCRE functions) +--SKIPIF-- + --EXPECTF-- +Warning: preg_split(): Compilation failed: \K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK) at offset 9 in %s on line %d bool(false) -Warning: preg_match(): Get subpatterns list failed in %s on line %d -array(0) { -} +Warning: preg_match(): Compilation failed: \K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK) at offset 12 in %s on line %d +NULL diff --git a/ext/pcre/tests/bug70345_old.phpt b/ext/pcre/tests/bug70345_old.phpt new file mode 100644 index 0000000000000..ea455a59330d4 --- /dev/null +++ b/ext/pcre/tests/bug70345_old.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #70345 (Multiple vulnerabilities related to PCRE functions) +--SKIPIF-- += 38) { + die("skip new pcre version"); +} +--FILE-- + +--EXPECTF-- +bool(false) + +Warning: preg_match(): Get subpatterns list failed in %s on line %d +array(0) { +}