This parameter is always zero and not necessary to call pcre2_match.
I'm leaving the parameter behind on the _ex() variant, so the preg_flags
are still accessible in some way.
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;
(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);
}
}
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 */
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
}
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 */
*/
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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2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iDu";
}
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
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 */
/* {{{ 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;
}
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;
#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;
pcre2_code *re;
pcre2_match_data *match_data;
- uint32_t re_options, capture_count;
+ uint32_t capture_count;
int rc;
/* Agent name too short */
}
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);
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
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;
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) {