summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-07-11 16:32:20 +0400
committerDmitry Stogov <dmitry@zend.com>2014-07-11 16:32:20 +0400
commit27f38798a1963de1c60aae4ef8a3675138255574 (patch)
tree479abed5848c1b7c9eacec88c85d98c80acf07e7 /ext
parent8f229b285527a403d46be047546384032a0f6bb3 (diff)
downloadphp-git-27f38798a1963de1c60aae4ef8a3675138255574.tar.gz
Fast parameter parsing API
This API is experemental. It may be changed or removed. It should be used only for really often used functions. (Keep the original parsing code and wrap usage with #ifndef FAST_ZPP)
Diffstat (limited to 'ext')
-rw-r--r--ext/pcre/php_pcre.c54
-rw-r--r--ext/reflection/php_reflection.c8
-rw-r--r--ext/spl/spl_array.c6
-rw-r--r--ext/standard/array.c111
-rw-r--r--ext/standard/basic_functions.c14
-rw-r--r--ext/standard/file.c12
-rw-r--r--ext/standard/filestat.c16
-rw-r--r--ext/standard/html.c19
-rw-r--r--ext/standard/math.c179
-rw-r--r--ext/standard/string.c101
-rw-r--r--ext/standard/type.c49
-rw-r--r--ext/standard/url.c24
12 files changed, 571 insertions, 22 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", &regex,
&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/", &regex, &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", &regex,
&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", &regex,
&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));
}
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index afa1a3dd06..7247542951 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -1494,9 +1494,17 @@ ZEND_METHOD(reflection, export)
int result;
zend_bool return_output = 0;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &object, reflector_ptr, &return_output) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_OBJECT_OF_CLASS(object, reflector_ptr)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(return_output)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
/* Invoke the __toString() method */
ZVAL_STRINGL(&fname, "__tostring", sizeof("__tostring") - 1);
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index ef3b821f1f..720a704e92 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -1261,9 +1261,15 @@ SPL_METHOD(Array, setIteratorClass)
spl_array_object *intern = Z_SPLARRAY_P(object);
zend_class_entry * ce_get_iterator = spl_ce_Iterator;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "C", &ce_get_iterator) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_CLASS(ce_get_iterator)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
intern->ce_get_iterator = ce_get_iterator;
}
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 9c2176652f..0e01b2ec68 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -292,9 +292,17 @@ PHP_FUNCTION(count)
long cnt;
zval *element;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &array, &mode) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_ZVAL(array)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(mode)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
switch (Z_TYPE_P(array)) {
case IS_NULL:
@@ -773,9 +781,15 @@ PHP_FUNCTION(end)
HashTable *array;
zval *entry;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H/", &array) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ARRAY_OR_OBJECT_HT_EX(array, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
zend_hash_internal_pointer_end(array);
@@ -800,9 +814,15 @@ PHP_FUNCTION(prev)
HashTable *array;
zval *entry;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H/", &array) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ARRAY_OR_OBJECT_HT_EX(array, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
zend_hash_move_backwards(array);
@@ -827,9 +847,15 @@ PHP_FUNCTION(next)
HashTable *array;
zval *entry;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H/", &array) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ARRAY_OR_OBJECT_HT_EX(array, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
zend_hash_move_forward(array);
@@ -854,9 +880,15 @@ PHP_FUNCTION(reset)
HashTable *array;
zval *entry;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H/", &array) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ARRAY_OR_OBJECT_HT_EX(array, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
zend_hash_internal_pointer_reset(array);
@@ -881,9 +913,15 @@ PHP_FUNCTION(current)
HashTable *array;
zval *entry;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H/", &array) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ARRAY_OR_OBJECT_HT_EX(array, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if ((entry = zend_hash_get_current_data(array)) == NULL) {
RETURN_FALSE;
@@ -903,9 +941,15 @@ PHP_FUNCTION(key)
{
HashTable *array;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H/", &array) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ARRAY_OR_OBJECT_HT_EX(array, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
zend_hash_get_current_key_zval(array, return_value);
}
@@ -1122,11 +1166,24 @@ PHP_FUNCTION(array_walk)
orig_array_walk_fci = BG(array_walk_fci);
orig_array_walk_fci_cache = BG(array_walk_fci_cache);
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H/f|z/", &array, &BG(array_walk_fci), &BG(array_walk_fci_cache), &userdata) == FAILURE) {
BG(array_walk_fci) = orig_array_walk_fci;
BG(array_walk_fci_cache) = orig_array_walk_fci_cache;
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_ARRAY_OR_OBJECT_HT_EX(array, 0, 1)
+ Z_PARAM_FUNC(BG(array_walk_fci), BG(array_walk_fci_cache))
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_EX(userdata, 0, 1)
+ ZEND_PARSE_PARAMETERS_END_EX(
+ BG(array_walk_fci) = orig_array_walk_fci;
+ BG(array_walk_fci_cache) = orig_array_walk_fci_cache;
+ return
+ );
+#endif
php_array_walk(array, userdata, 0 TSRMLS_CC);
BG(array_walk_fci) = orig_array_walk_fci;
@@ -1174,9 +1231,18 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{
zend_string *str_idx;
zend_bool strict = 0; /* strict comparison or not */
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "za|b", &value, &array, &strict) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_ZVAL(value)
+ Z_PARAM_ARRAY(array)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(strict)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (strict) {
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
@@ -1928,9 +1994,15 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
zend_string *key = NULL;
ulong index;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/", &stack) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ARRAY_EX(stack, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (zend_hash_num_elements(Z_ARRVAL_P(stack)) == 0) {
return;
@@ -2155,9 +2227,19 @@ PHP_FUNCTION(array_slice)
zend_string *string_key;
ulong num_key;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "al|zb", &input, &offset, &z_length, &preserve_keys) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, 4)
+ Z_PARAM_ARRAY(input)
+ Z_PARAM_LONG(offset)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL(z_length)
+ Z_PARAM_BOOL(preserve_keys)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
/* Get number of entries in the input hash */
num_in = zend_hash_num_elements(Z_ARRVAL_P(input));
@@ -2393,9 +2475,15 @@ static void php_array_merge_or_replace_wrapper(INTERNAL_FUNCTION_PARAMETERS, int
zval *args = NULL;
int argc, i, init_size = 0;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &argc) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, -1)
+ Z_PARAM_VARIADIC('+', args, argc)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
for (i = 0; i < argc; i++) {
zval *arg = args + i;
@@ -2477,9 +2565,18 @@ PHP_FUNCTION(array_keys)
zend_string *str_idx;
int (*is_equal_func)(zval *, zval *, zval * TSRMLS_DC) = is_equal_function;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|zb", &input, &search_value, &strict) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_ARRAY(input)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL(search_value)
+ Z_PARAM_BOOL(strict)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (strict) {
is_equal_func = is_identical_function;
@@ -4318,9 +4415,16 @@ PHP_FUNCTION(array_map)
zend_fcall_info_cache fci_cache = empty_fcall_info_cache;
int i, k, maxlen = 0;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f!+", &fci, &fci_cache, &arrays, &n_arrays) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, -1)
+ Z_PARAM_FUNC_EX(fci, fci_cache, 1, 0)
+ Z_PARAM_VARIADIC('+', arrays, n_arrays)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETVAL_NULL();
@@ -4473,9 +4577,16 @@ PHP_FUNCTION(array_key_exists)
zval *key; /* key to check for */
HashTable *array; /* array to check in */
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zH", &key, &array) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_ZVAL(key)
+ Z_PARAM_ARRAY_OR_OBJECT_HT(array)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
switch (Z_TYPE_P(key)) {
case IS_STRING:
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 644e364f21..c513090b19 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -4712,9 +4712,16 @@ PHP_FUNCTION(call_user_func)
zend_fcall_info fci;
zend_fcall_info_cache fci_cache;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f*", &fci, &fci_cache, &fci.params, &fci.param_count) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, -1)
+ Z_PARAM_FUNC(fci, fci_cache)
+ Z_PARAM_VARIADIC('*', fci.params, fci.param_count)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
fci.retval = &retval;
@@ -4732,9 +4739,16 @@ PHP_FUNCTION(call_user_func_array)
zend_fcall_info fci;
zend_fcall_info_cache fci_cache;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "fa/", &fci, &fci_cache, &params) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_FUNC(fci, fci_cache)
+ Z_PARAM_ARRAY_EX(params, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
zend_fcall_info_args(&fci, params TSRMLS_CC);
fci.retval = &retval;
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 1b14849954..4551bef8cf 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -893,9 +893,15 @@ PHPAPI PHP_FUNCTION(fclose)
zval *arg1;
php_stream *stream;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) {
RETURN_FALSE;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(arg1)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+#endif
PHP_STREAM_TO_ZVAL(stream, arg1);
@@ -2309,9 +2315,15 @@ PHP_FUNCTION(realpath)
int filename_len;
char resolved_path_buff[MAXPATHLEN];
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_PATH(filename, filename_len)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (VCWD_REALPATH(filename, resolved_path_buff)) {
if (php_check_open_basedir(resolved_path_buff TSRMLS_CC)) {
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
index 4232af4d1c..9fb35ef344 100644
--- a/ext/standard/filestat.c
+++ b/ext/standard/filestat.c
@@ -1077,7 +1077,8 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ
/* another quickie macro to make defining similar functions easier */
/* {{{ FileFunction(name, funcnum) */
-#define FileFunction(name, funcnum) \
+#ifndef FAST_ZPP
+# define FileFunction(name, funcnum) \
void name(INTERNAL_FUNCTION_PARAMETERS) { \
char *filename; \
int filename_len; \
@@ -1088,6 +1089,19 @@ void name(INTERNAL_FUNCTION_PARAMETERS) { \
\
php_stat(filename, (php_stat_len) filename_len, funcnum, return_value TSRMLS_CC); \
}
+#else
+# define FileFunction(name, funcnum) \
+void name(INTERNAL_FUNCTION_PARAMETERS) { \
+ char *filename; \
+ int filename_len; \
+ \
+ ZEND_PARSE_PARAMETERS_START(1, 1) \
+ Z_PARAM_PATH(filename, filename_len) \
+ ZEND_PARSE_PARAMETERS_END(); \
+ \
+ php_stat(filename, (php_stat_len) filename_len, funcnum, return_value TSRMLS_CC); \
+}
+#endif
/* }}} */
/* {{{ proto int fileperms(string filename)
diff --git a/ext/standard/html.c b/ext/standard/html.c
index 7564fb8217..360639ea76 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -1448,9 +1448,19 @@ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all)
zend_string *replaced;
zend_bool double_encode = 1;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!b", &str, &str_len, &flags, &hint_charset, &hint_charset_len, &double_encode) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 4)
+ Z_PARAM_STRING(str, str_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(flags)
+ Z_PARAM_STRING_EX(hint_charset, hint_charset_len, 1, 0)
+ Z_PARAM_BOOL(double_encode);
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (!hint_charset) {
hint_charset = get_default_charset(TSRMLS_C);
@@ -1521,10 +1531,19 @@ PHP_FUNCTION(html_entity_decode)
long quote_style = ENT_COMPAT;
zend_string *replaced;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len,
&quote_style, &hint_charset, &hint_charset_len) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_STRING(str, str_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(quote_style)
+ Z_PARAM_STRING(hint_charset, hint_charset_len)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (!hint_charset) {
hint_charset = get_default_charset(TSRMLS_C);
diff --git a/ext/standard/math.c b/ext/standard/math.c
index 9e98fd35ff..06723216c6 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -382,9 +382,15 @@ PHP_FUNCTION(sin)
{
double num;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(num)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_DOUBLE(sin(num));
}
/* }}} */
@@ -395,9 +401,15 @@ PHP_FUNCTION(cos)
{
double num;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(num)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_DOUBLE(cos(num));
}
/* }}} */
@@ -408,9 +420,15 @@ PHP_FUNCTION(tan)
{
double num;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(num)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_DOUBLE(tan(num));
}
/* }}} */
@@ -421,9 +439,15 @@ PHP_FUNCTION(asin)
{
double num;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(num)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_DOUBLE(asin(num));
}
/* }}} */
@@ -434,9 +458,15 @@ PHP_FUNCTION(acos)
{
double num;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(num)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_DOUBLE(acos(num));
}
/* }}} */
@@ -447,9 +477,15 @@ PHP_FUNCTION(atan)
{
double num;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(num)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_DOUBLE(atan(num));
}
/* }}} */
@@ -460,9 +496,16 @@ PHP_FUNCTION(atan2)
{
double num1, num2;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &num1, &num2) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_DOUBLE(num1)
+ Z_PARAM_DOUBLE(num2)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_DOUBLE(atan2(num1, num2));
}
/* }}} */
@@ -473,9 +516,15 @@ PHP_FUNCTION(sinh)
{
double num;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(num)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_DOUBLE(sinh(num));
}
/* }}} */
@@ -486,9 +535,15 @@ PHP_FUNCTION(cosh)
{
double num;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(num)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_DOUBLE(cosh(num));
}
/* }}} */
@@ -499,9 +554,15 @@ PHP_FUNCTION(tanh)
{
double num;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(num)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_DOUBLE(tanh(num));
}
/* }}} */
@@ -512,9 +573,15 @@ PHP_FUNCTION(asinh)
{
double num;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(num)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_DOUBLE(php_asinh(num));
}
/* }}} */
@@ -525,9 +592,15 @@ PHP_FUNCTION(acosh)
{
double num;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(num)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_DOUBLE(php_acosh(num));
}
/* }}} */
@@ -538,9 +611,15 @@ PHP_FUNCTION(atanh)
{
double num;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(num)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_DOUBLE(php_atanh(num));
}
/* }}} */
@@ -559,9 +638,15 @@ PHP_FUNCTION(is_finite)
{
double dval;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &dval) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(dval)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_BOOL(zend_finite(dval));
}
/* }}} */
@@ -572,9 +657,15 @@ PHP_FUNCTION(is_infinite)
{
double dval;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &dval) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(dval)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_BOOL(zend_isinf(dval));
}
/* }}} */
@@ -585,9 +676,15 @@ PHP_FUNCTION(is_nan)
{
double dval;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &dval) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(dval)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_BOOL(zend_isnan(dval));
}
/* }}} */
@@ -612,9 +709,15 @@ PHP_FUNCTION(exp)
{
double num;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(num)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_DOUBLE(exp(num));
}
@@ -630,9 +733,16 @@ PHP_FUNCTION(expm1)
{
double num;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(num)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
+
RETURN_DOUBLE(php_expm1(num));
}
/* }}} */
@@ -647,9 +757,16 @@ PHP_FUNCTION(log1p)
{
double num;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(num)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
+
RETURN_DOUBLE(php_log1p(num));
}
/* }}} */
@@ -660,9 +777,18 @@ PHP_FUNCTION(log)
{
double num, base = 0;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|d", &num, &base) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_DOUBLE(num)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_DOUBLE(base)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
+
if (ZEND_NUM_ARGS() == 1) {
RETURN_DOUBLE(log(num));
}
@@ -684,9 +810,16 @@ PHP_FUNCTION(log10)
{
double num;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(num)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
+
RETURN_DOUBLE(log10(num));
}
/* }}} */
@@ -697,9 +830,16 @@ PHP_FUNCTION(sqrt)
{
double num;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(num)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
+
RETURN_DOUBLE(sqrt(num));
}
/* }}} */
@@ -710,9 +850,17 @@ PHP_FUNCTION(hypot)
{
double num1, num2;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &num1, &num2) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_DOUBLE(num1)
+ Z_PARAM_DOUBLE(num2)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
+
#if HAVE_HYPOT
RETURN_DOUBLE(hypot(num1, num2));
#elif defined(_MSC_VER)
@@ -729,9 +877,15 @@ PHP_FUNCTION(deg2rad)
{
double deg;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &deg) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(deg)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_DOUBLE((deg / 180.0) * M_PI);
}
/* }}} */
@@ -742,9 +896,16 @@ PHP_FUNCTION(rad2deg)
{
double rad;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &rad) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(rad)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
+
RETURN_DOUBLE((rad / M_PI) * 180);
}
/* }}} */
@@ -1182,9 +1343,19 @@ PHP_FUNCTION(number_format)
char thousand_sep_chr = ',', dec_point_chr = '.';
int thousand_sep_len = 0, dec_point_len = 0;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|ls!s!", &num, &dec, &dec_point, &dec_point_len, &thousand_sep, &thousand_sep_len) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 4)
+ Z_PARAM_DOUBLE(num)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(dec)
+ Z_PARAM_STRING_EX(dec_point, dec_point_len, 1, 0)
+ Z_PARAM_STRING_EX(thousand_sep, thousand_sep_len, 1, 0)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
switch(ZEND_NUM_ARGS()) {
case 1:
@@ -1220,9 +1391,17 @@ PHP_FUNCTION(fmod)
{
double num1, num2;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &num1, &num2) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_DOUBLE(num1)
+ Z_PARAM_DOUBLE(num2)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
+
RETURN_DOUBLE(fmod(num1, num2));
}
/* }}} */
diff --git a/ext/standard/string.c b/ext/standard/string.c
index ceebf77a70..ec9b8a02a2 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -834,9 +834,17 @@ static void php_do_trim(INTERNAL_FUNCTION_PARAMETERS, int mode)
char *what = NULL;
int str_len, what_len = 0;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, &str_len, &what, &what_len) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STRING(str, str_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING(what, what_len)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
php_trim(str, str_len, what, what_len, return_value, mode TSRMLS_CC);
}
@@ -1082,9 +1090,18 @@ PHP_FUNCTION(explode)
long limit = LONG_MAX; /* No limit */
zval zdelim, zstr;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|l", &delim, &str, &limit) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STR(delim)
+ Z_PARAM_STR(str)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(limit)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (delim->len == 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter");
@@ -1192,9 +1209,17 @@ PHP_FUNCTION(implode)
{
zval *arg1 = NULL, *arg2 = NULL, *delim, *arr, tmp;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &arg1, &arg2) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_ZVAL(arg1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL(arg2)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (arg2 == NULL) {
if (Z_TYPE_P(arg1) != IS_ARRAY) {
@@ -1365,9 +1390,15 @@ PHP_FUNCTION(strtolower)
int arglen;
zend_string *result;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &arglen) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(str, arglen)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
result = STR_INIT(str, arglen, 0);
php_strtolower(result->val, result->len);
@@ -1777,9 +1808,18 @@ PHP_FUNCTION(strpos)
long offset = 0;
int haystack_len;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &haystack, &haystack_len, &needle, &offset) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STRING(haystack, haystack_len)
+ Z_PARAM_ZVAL(needle)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(offset)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (offset < 0 || offset > haystack_len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not contained in string");
@@ -1889,9 +1929,18 @@ PHP_FUNCTION(strrpos)
long offset = 0;
char *p, *e, ord_needle[2];
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &haystack, &haystack_len, &zneedle, &offset) == FAILURE) {
RETURN_FALSE;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STRING(haystack, haystack_len)
+ Z_PARAM_ZVAL(zneedle)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(offset)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+#endif
if (Z_TYPE_P(zneedle) == IS_STRING) {
needle = Z_STRVAL_P(zneedle);
@@ -2192,9 +2241,18 @@ PHP_FUNCTION(substr)
int str_len;
int argc = ZEND_NUM_ARGS();
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|l", &str, &str_len, &f, &l) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STRING(str, str_len)
+ Z_PARAM_LONG(f)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(l)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (argc > 2) {
if ((l < 0 && -l > str_len)) {
@@ -2584,9 +2642,15 @@ PHP_FUNCTION(ord)
char *str;
int str_len;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(str, str_len)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_LONG((unsigned char) str[0]);
}
@@ -2631,9 +2695,15 @@ PHP_FUNCTION(ucfirst)
char *str;
int str_len;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(str, str_len)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (!str_len) {
RETURN_EMPTY_STRING();
@@ -2682,9 +2752,15 @@ PHP_FUNCTION(ucwords)
register char *r, *r_end;
int str_len;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(str, str_len)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (!str_len) {
RETURN_EMPTY_STRING();
@@ -2895,9 +2971,18 @@ PHP_FUNCTION(strtr)
int str_len, to_len = 0;
int ac = ZEND_NUM_ARGS();
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|s", &str, &str_len, &from, &to, &to_len) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STRING(str, str_len)
+ Z_PARAM_ZVAL(from)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING(to, to_len)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (ac == 2 && Z_TYPE_P(from) != IS_ARRAY) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The second argument is not an array");
@@ -3109,9 +3194,15 @@ PHP_FUNCTION(addslashes)
char *str;
int str_len;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(str, str_len)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (str_len == 0) {
RETURN_EMPTY_STRING();
@@ -3722,9 +3813,19 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit
int count = 0;
int argc = ZEND_NUM_ARGS();
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzz|z/", &search, &replace, &subject, &zcount) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(3, 4)
+ Z_PARAM_ZVAL(search)
+ Z_PARAM_ZVAL(replace)
+ Z_PARAM_ZVAL(subject)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_EX(zcount, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
/* Make sure we're dealing with strings and do the replacement. */
if (Z_TYPE_P(search) != IS_ARRAY) {
diff --git a/ext/standard/type.c b/ext/standard/type.c
index 72f1660932..ab3224628c 100644
--- a/ext/standard/type.c
+++ b/ext/standard/type.c
@@ -137,27 +137,22 @@ PHP_FUNCTION(settype)
PHP_FUNCTION(intval)
{
zval *num;
- long arg_base;
- int base;
+ long base = 10;
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &num) == FAILURE) {
- return;
- }
- base = 10;
- break;
-
- case 2:
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &num, &arg_base) == FAILURE) {
- return;
- }
- base = arg_base;
- break;
-
- default:
- WRONG_PARAM_COUNT;
+ if (ZEND_NUM_ARGS() != 1 && ZEND_NUM_ARGS() != 2) {
+ WRONG_PARAM_COUNT;
+ }
+#ifndef FAST_ZPP
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &num, &base) == FAILURE) {
+ return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_ZVAL(num)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(base)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETVAL_ZVAL(num, 1, 0);
convert_to_long_base(return_value, base);
@@ -206,15 +201,21 @@ PHP_FUNCTION(strval)
}
/* }}} */
-static void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type)
+static inline void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type)
{
zval *arg;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) {
RETURN_FALSE;
}
-
ZVAL_DEREF(arg);
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ZVAL_DEREF(arg)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+#endif
+
if (Z_TYPE_P(arg) == type) {
if (type == IS_OBJECT) {
zend_class_entry *ce;
@@ -348,9 +349,15 @@ PHP_FUNCTION(is_scalar)
{
zval *arg;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ZVAL(arg)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
switch (Z_TYPE_P(arg)) {
case IS_FALSE:
diff --git a/ext/standard/url.c b/ext/standard/url.c
index a18c035151..7e848fecfe 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -537,9 +537,15 @@ PHP_FUNCTION(urlencode)
{
zend_string *in_str;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &in_str) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(in_str)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_STR(php_url_encode(in_str->val, in_str->len));
}
@@ -551,9 +557,15 @@ PHP_FUNCTION(urldecode)
{
zend_string *in_str, *out_str;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &in_str) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(in_str)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
out_str = STR_INIT(in_str->val, in_str->len, 0);
out_str->len = php_url_decode(out_str->val, out_str->len);
@@ -632,9 +644,15 @@ PHP_FUNCTION(rawurlencode)
{
zend_string *in_str;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &in_str) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(in_str)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETURN_STR(php_raw_url_encode(in_str->val, in_str->len));
}
@@ -646,9 +664,15 @@ PHP_FUNCTION(rawurldecode)
{
zend_string *in_str, *out_str;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &in_str) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(in_str)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
out_str = STR_INIT(in_str->val, in_str->len, 0);
out_str->len = php_raw_url_decode(out_str->val, out_str->len);