@@ -50,7 +50,6 @@ struct _pcre_cache_entry {
50
50
uint32_t capture_count ;
51
51
uint32_t name_count ;
52
52
uint32_t compile_options ;
53
- uint32_t extra_compile_options ;
54
53
uint32_t refcount ;
55
54
};
56
55
@@ -167,7 +166,6 @@ static void php_pcre_free(void *block, void *data)
167
166
pefree (block , 1 );
168
167
}/*}}}*/
169
168
170
- #define PHP_PCRE_DEFAULT_EXTRA_COPTIONS PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL
171
169
#define PHP_PCRE_PREALLOC_MDATA_SIZE 32
172
170
173
171
static void php_pcre_init_pcre2 (uint8_t jit )
@@ -188,12 +186,6 @@ static void php_pcre_init_pcre2(uint8_t jit)
188
186
}
189
187
}
190
188
191
- /* XXX The 'X' modifier is the default behavior in PCRE2. This option is
192
- called dangerous in the manual, as typos in patterns can cause
193
- unexpected results. We might want to to switch to the default PCRE2
194
- behavior, too, thus causing a certain BC break. */
195
- pcre2_set_compile_extra_options (cctx , PHP_PCRE_DEFAULT_EXTRA_COPTIONS );
196
-
197
189
if (!mctx ) {
198
190
mctx = pcre2_match_context_create (gctx );
199
191
if (!mctx ) {
@@ -569,7 +561,6 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
569
561
{
570
562
pcre2_code * re = NULL ;
571
563
uint32_t coptions = 0 ;
572
- uint32_t extra_coptions = PHP_PCRE_DEFAULT_EXTRA_COPTIONS ;
573
564
PCRE2_UCHAR error [128 ];
574
565
PCRE2_SIZE erroffset ;
575
566
int errnumber ;
@@ -704,7 +695,6 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
704
695
case 'D' : coptions |= PCRE2_DOLLAR_ENDONLY ;break ;
705
696
case 'S' : /* Pass. */ break ;
706
697
case 'U' : coptions |= PCRE2_UNGREEDY ; break ;
707
- case 'X' : extra_coptions &= ~PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL ; break ;
708
698
case 'u' : coptions |= PCRE2_UTF ;
709
699
/* In PCRE, by default, \d, \D, \s, \S, \w, and \W recognize only ASCII
710
700
characters, even in UTF-8 mode. However, this can be changed by setting
@@ -767,19 +757,9 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
767
757
pcre2_set_character_tables (cctx , tables );
768
758
}
769
759
770
- /* Set extra options for the compile context. */
771
- if (PHP_PCRE_DEFAULT_EXTRA_COPTIONS != extra_coptions ) {
772
- pcre2_set_compile_extra_options (cctx , extra_coptions );
773
- }
774
-
775
760
/* Compile pattern and display a warning if compilation failed. */
776
761
re = pcre2_compile ((PCRE2_SPTR )pattern , pattern_len , coptions , & errnumber , & erroffset , cctx );
777
762
778
- /* Reset the compile context extra options to default. */
779
- if (PHP_PCRE_DEFAULT_EXTRA_COPTIONS != extra_coptions ) {
780
- pcre2_set_compile_extra_options (cctx , PHP_PCRE_DEFAULT_EXTRA_COPTIONS );
781
- }
782
-
783
763
if (re == NULL ) {
784
764
if (key != regex ) {
785
765
zend_string_release_ex (key , 0 );
@@ -823,7 +803,6 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
823
803
new_entry .re = re ;
824
804
new_entry .preg_options = poptions ;
825
805
new_entry .compile_options = coptions ;
826
- new_entry .extra_compile_options = extra_coptions ;
827
806
new_entry .refcount = 0 ;
828
807
829
808
rc = pcre2_pattern_info (re , PCRE2_INFO_CAPTURECOUNT , & new_entry .capture_count );
0 commit comments