@@ -4679,6 +4679,7 @@ static int php_pgsql_convert_match(const zend_string *str, const char *regex , s
4679
4679
uint32_t options = PCRE2_NO_AUTO_CAPTURE ;
4680
4680
size_t i ;
4681
4681
pcre2_match_data * match_data ;
4682
+ PCRE2_UCHAR err_msg [128 ];
4682
4683
4683
4684
/* Check invalid chars for POSIX regex */
4684
4685
for (i = 0 ; i < ZSTR_LEN (str ); i ++ ) {
@@ -4695,11 +4696,22 @@ static int php_pgsql_convert_match(const zend_string *str, const char *regex , s
4695
4696
4696
4697
re = pcre2_compile ((PCRE2_SPTR )regex , regex_len , options , & errnumber , & err_offset , php_pcre_cctx ());
4697
4698
if (NULL == re ) {
4698
- PCRE2_UCHAR err_msg [128 ];
4699
4699
pcre2_get_error_message (errnumber , err_msg , sizeof (err_msg ));
4700
4700
php_error_docref (NULL , E_WARNING , "Cannot compile regex: '%s'" , err_msg );
4701
4701
return FAILURE ;
4702
4702
}
4703
+ #if defined(HAVE_PCRE_JIT_SUPPORT )
4704
+ if (PCRE_G (jit )) {
4705
+ /*
4706
+ * Check if the JIT pass did not work, but the regex had been compiled successfully earlier
4707
+ * so let's not end it here.
4708
+ */
4709
+ if (UNEXPECTED (pcre2_jit_compile (re , PCRE2_JIT_COMPLETE ) != 0 )) {
4710
+ pcre2_get_error_message (errnumber , err_msg , sizeof (err_msg ));
4711
+ php_error_docref (NULL , E_WARNING , "Cannot use JIT on regex: '%s'" , err_msg );
4712
+ }
4713
+ }
4714
+ #endif
4703
4715
4704
4716
match_data = php_pcre_create_match_data (0 , re );
4705
4717
if (NULL == match_data ) {
0 commit comments