summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/fileinfo/libmagic/softmagic.c6
-rw-r--r--ext/filter/logical_filters.c12
-rw-r--r--ext/pcre/php_pcre.c7
-rw-r--r--ext/pcre/php_pcre.h2
-rw-r--r--ext/standard/browscap.c6
-rw-r--r--ext/zip/php_zip.c6
6 files changed, 18 insertions, 21 deletions
diff --git a/ext/fileinfo/libmagic/softmagic.c b/ext/fileinfo/libmagic/softmagic.c
index d37ce0d255..a270f97eca 100644
--- a/ext/fileinfo/libmagic/softmagic.c
+++ b/ext/fileinfo/libmagic/softmagic.c
@@ -423,7 +423,7 @@ private int
check_fmt(struct magic_set *ms, const char *fmt)
{
pcre2_code *pce;
- uint32_t re_options, capture_count;
+ uint32_t capture_count;
int rv = -1;
zend_string *pattern;
@@ -432,12 +432,12 @@ check_fmt(struct magic_set *ms, const char *fmt)
(void)setlocale(LC_CTYPE, "C");
pattern = zend_string_init("~%[-0-9\\.]*s~", sizeof("~%[-0-9\\.]*s~") - 1, 0);
- if ((pce = pcre_get_compiled_regex(pattern, &capture_count, &re_options)) == NULL) {
+ if ((pce = pcre_get_compiled_regex(pattern, &capture_count)) == NULL) {
rv = -1;
} else {
pcre2_match_data *match_data = php_pcre_create_match_data(capture_count, pce);
if (match_data) {
- rv = pcre2_match(pce, (PCRE2_SPTR)fmt, strlen(fmt), 0, re_options, match_data, php_pcre_mctx()) > 0;
+ rv = pcre2_match(pce, (PCRE2_SPTR)fmt, strlen(fmt), 0, 0, match_data, php_pcre_mctx()) > 0;
php_pcre_free_match_data(match_data);
}
}
diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c
index 3dcbf21443..c4096593dc 100644
--- a/ext/filter/logical_filters.c
+++ b/ext/filter/logical_filters.c
@@ -444,7 +444,7 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
int regexp_set;
pcre2_code *re = NULL;
pcre2_match_data *match_data = NULL;
- uint32_t preg_options, capture_count;
+ uint32_t capture_count;
int rc;
/* Parse options */
@@ -455,7 +455,7 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
RETURN_VALIDATION_FAILED
}
- re = pcre_get_compiled_regex(regexp, &capture_count, &preg_options);
+ re = pcre_get_compiled_regex(regexp, &capture_count);
if (!re) {
RETURN_VALIDATION_FAILED
}
@@ -463,7 +463,7 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
if (!match_data) {
RETURN_VALIDATION_FAILED
}
- rc = pcre2_match(re, (PCRE2_SPTR)Z_STRVAL_P(value), Z_STRLEN_P(value), 0, preg_options, match_data, php_pcre_mctx());
+ rc = pcre2_match(re, (PCRE2_SPTR)Z_STRVAL_P(value), Z_STRLEN_P(value), 0, 0, match_data, php_pcre_mctx());
php_pcre_free_match_data(match_data);
/* 0 means that the vector is too small to hold all the captured substring offsets */
@@ -624,7 +624,7 @@ void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
*/
pcre2_code *re = NULL;
pcre2_match_data *match_data = NULL;
- uint32_t preg_options = 0, capture_count;
+ uint32_t capture_count;
zend_string *sregexp;
int rc;
const char regexp0[] = "/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E\\pL\\pN]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F\\pL\\pN]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E\\pL\\pN]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F\\pL\\pN]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-+[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-+[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iDu";
@@ -646,7 +646,7 @@ void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
}
sregexp = zend_string_init(regexp, regexp_len, 0);
- re = pcre_get_compiled_regex(sregexp, &capture_count, &preg_options);
+ re = pcre_get_compiled_regex(sregexp, &capture_count);
zend_string_release_ex(sregexp, 0);
if (!re) {
RETURN_VALIDATION_FAILED
@@ -655,7 +655,7 @@ void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
if (!match_data) {
RETURN_VALIDATION_FAILED
}
- rc = pcre2_match(re, (PCRE2_SPTR)Z_STRVAL_P(value), Z_STRLEN_P(value), 0, preg_options, match_data, php_pcre_mctx());
+ rc = pcre2_match(re, (PCRE2_SPTR)Z_STRVAL_P(value), Z_STRLEN_P(value), 0, 0, match_data, php_pcre_mctx());
php_pcre_free_match_data(match_data);
/* 0 means that the vector is too small to hold all the captured substring offsets */
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index a7c1a93646..da5b69ed55 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -862,13 +862,10 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
/* {{{ pcre_get_compiled_regex
*/
-PHPAPI pcre2_code *pcre_get_compiled_regex(zend_string *regex, uint32_t *capture_count, uint32_t *preg_options)
+PHPAPI pcre2_code *pcre_get_compiled_regex(zend_string *regex, uint32_t *capture_count)
{
pcre_cache_entry * pce = pcre_get_compiled_regex_cache(regex);
- if (preg_options) {
- *preg_options = 0;
- }
if (capture_count) {
*capture_count = pce ? pce->capture_count : 0;
}
@@ -884,7 +881,7 @@ PHPAPI pcre2_code* pcre_get_compiled_regex_ex(zend_string *regex, uint32_t *capt
pcre_cache_entry * pce = pcre_get_compiled_regex_cache(regex);
if (preg_options) {
- *preg_options = 0;
+ *preg_options = pce ? pce->preg_options : 0;
}
if (compile_options) {
*compile_options = pce ? pce->compile_options : 0;
diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h
index 4c240cbaf9..5afca0b533 100644
--- a/ext/pcre/php_pcre.h
+++ b/ext/pcre/php_pcre.h
@@ -32,7 +32,7 @@
#endif
PHPAPI zend_string *php_pcre_replace(zend_string *regex, zend_string *subject_str, char *subject, size_t subject_len, zend_string *replace_str, size_t limit, size_t *replace_count);
-PHPAPI pcre2_code* pcre_get_compiled_regex(zend_string *regex, uint32_t *capture_count, uint32_t *options);
+PHPAPI pcre2_code* pcre_get_compiled_regex(zend_string *regex, uint32_t *capture_count);
PHPAPI pcre2_code* pcre_get_compiled_regex_ex(zend_string *regex, uint32_t *capture_count, uint32_t *preg_options, uint32_t *coptions);
extern zend_module_entry pcre_module_entry;
diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c
index 89bc32cde9..58bc678dca 100644
--- a/ext/standard/browscap.c
+++ b/ext/standard/browscap.c
@@ -573,7 +573,7 @@ static int browser_reg_compare(browscap_entry *entry, zend_string *agent_name, b
pcre2_code *re;
pcre2_match_data *match_data;
- uint32_t re_options, capture_count;
+ uint32_t capture_count;
int rc;
/* Agent name too short */
@@ -616,7 +616,7 @@ static int browser_reg_compare(browscap_entry *entry, zend_string *agent_name, b
}
regex = browscap_convert_pattern(entry->pattern, 0);
- re = pcre_get_compiled_regex(regex, &capture_count, &re_options);
+ re = pcre_get_compiled_regex(regex, &capture_count);
if (re == NULL) {
ZSTR_ALLOCA_FREE(pattern_lc, use_heap);
zend_string_release(regex);
@@ -629,7 +629,7 @@ static int browser_reg_compare(browscap_entry *entry, zend_string *agent_name, b
zend_string_release(regex);
return 0;
}
- rc = pcre2_match(re, (PCRE2_SPTR)ZSTR_VAL(agent_name), ZSTR_LEN(agent_name), 0, re_options, match_data, php_pcre_mctx());
+ rc = pcre2_match(re, (PCRE2_SPTR)ZSTR_VAL(agent_name), ZSTR_LEN(agent_name), 0, 0, match_data, php_pcre_mctx());
php_pcre_free_match_data(match_data);
if (PCRE2_ERROR_NOMATCH != rc) {
/* If we've found a possible browser, we need to do a comparison of the
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index a7f63b0526..5aa17fb669 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -654,10 +654,10 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val
if (files_cnt > 0) {
pcre2_code *re = NULL;
pcre2_match_data *match_data = NULL;
- uint32_t preg_options = 0, i, capture_count;
+ uint32_t i, capture_count;
int rc;
- re = pcre_get_compiled_regex(regexp, &capture_count, &preg_options);
+ re = pcre_get_compiled_regex(regexp, &capture_count);
if (!re) {
php_error_docref(NULL, E_WARNING, "Invalid expression");
return -1;
@@ -703,7 +703,7 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val
zend_string_release_ex(namelist[i], 0);
continue;
}
- rc = pcre2_match(re, (PCRE2_SPTR)ZSTR_VAL(namelist[i]), ZSTR_LEN(namelist[i]), 0, preg_options, match_data, mctx);
+ rc = pcre2_match(re, (PCRE2_SPTR)ZSTR_VAL(namelist[i]), ZSTR_LEN(namelist[i]), 0, 0, match_data, mctx);
php_pcre_free_match_data(match_data);
/* 0 means that the vector is too small to hold all the captured substring offsets */
if (rc < 0) {