diff options
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r-- | ext/pcre/php_pcre.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index e4b76013bb..4731db21fb 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -548,10 +548,21 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ * long flags = 0; /* Match control flags */ long start_offset = 0; /* Where the new search starts */ +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ss|z/ll", ®ex, &subject, &subject_len, &subpats, &flags, &start_offset) == FAILURE) { RETURN_FALSE; } +#else + ZEND_PARSE_PARAMETERS_START(2, 5) + Z_PARAM_STR(regex) + Z_PARAM_STRING(subject, subject_len) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_EX(subpats, 0, 1) + Z_PARAM_LONG(flags) + Z_PARAM_LONG(start_offset) + ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); +#endif /* Compile regex or get it from cache. */ if ((pce = pcre_get_compiled_regex_cache(regex TSRMLS_CC)) == NULL) { @@ -1431,10 +1442,21 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl zend_string *callback_name; int replace_count=0, old_replace_count; +#ifndef FAST_ZPP /* Get function parameters and do error-checking. */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzz|lz/", ®ex, &replace, &subject, &limit, &zcount) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(3, 5) + Z_PARAM_ZVAL(regex) + Z_PARAM_ZVAL(replace) + Z_PARAM_ZVAL(subject) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(limit) + Z_PARAM_ZVAL_EX(zcount, 0, 1) + ZEND_PARSE_PARAMETERS_END(); +#endif if (!is_callable_replace && Z_TYPE_P(replace) == IS_ARRAY && Z_TYPE_P(regex) != IS_ARRAY) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter mismatch, pattern is a string while replacement is an array"); @@ -1539,10 +1561,20 @@ static PHP_FUNCTION(preg_split) pcre_cache_entry *pce; /* Compiled regular expression */ /* Get function parameters and do error checking */ +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ss|ll", ®ex, &subject, &subject_len, &limit_val, &flags) == FAILURE) { RETURN_FALSE; } +#else + ZEND_PARSE_PARAMETERS_START(2, 4) + Z_PARAM_STR(regex) + Z_PARAM_STRING(subject, subject_len) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(limit_val) + Z_PARAM_LONG(flags) + ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); +#endif /* Compile regex or get it from cache. */ if ((pce = pcre_get_compiled_regex_cache(regex TSRMLS_CC)) == NULL) { @@ -1747,10 +1779,18 @@ static PHP_FUNCTION(preg_quote) zend_bool quote_delim = 0; /* Whether to quote additional delim char */ /* Get the arguments and check for errors */ +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &in_str, &in_str_len, &delim, &delim_len) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STRING(in_str, in_str_len) + Z_PARAM_OPTIONAL + Z_PARAM_STRING(delim, delim_len) + ZEND_PARSE_PARAMETERS_END(); +#endif in_str_end = in_str + in_str_len; @@ -1828,10 +1868,19 @@ static PHP_FUNCTION(preg_grep) pcre_cache_entry *pce; /* Compiled regular expression */ /* Get arguments and do error checking */ +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sa|l", ®ex, &input, &flags) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(regex) + Z_PARAM_ARRAY(input) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(flags) + ZEND_PARSE_PARAMETERS_END(); +#endif /* Compile regex or get it from cache. */ if ((pce = pcre_get_compiled_regex_cache(regex TSRMLS_CC)) == NULL) { @@ -1930,9 +1979,14 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return Returns the error code of the last regexp execution. */ static PHP_FUNCTION(preg_last_error) { +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(0, 0) + ZEND_PARSE_PARAMETERS_END(); +#endif RETURN_LONG(PCRE_G(error_code)); } |