From dd61002676cbb4ff222a743ffd18ea940bc0085d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 21 Oct 2021 10:39:57 +0200 Subject: [PATCH] fix for pcre2 10.38 --- ext/pcre/php_pcre.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index f7b780f520e..19567889d88 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -193,6 +193,13 @@ 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) @@ -213,6 +220,8 @@ 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) {