summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/zend.h8
-rw-r--r--Zend/zend_API.c90
-rw-r--r--Zend/zend_API.h604
-rw-r--r--Zend/zend_builtin_functions.c73
-rw-r--r--Zend/zend_operators.c4
-rw-r--r--Zend/zend_operators.h2
-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
18 files changed, 1351 insertions, 23 deletions
diff --git a/Zend/zend.h b/Zend/zend.h
index 2f1f239732..1021829c3b 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -179,6 +179,14 @@ char *alloca ();
# define ZEND_ATTRIBUTE_DEPRECATED
#endif
+#if defined(__GNUC__) && ZEND_GCC_VERSION >= 4003
+# define ZEND_ATTRIBUTE_UNUSED __attribute__((unused))
+# define ZEND_ATTRIBUTE_UNUSED_LABEL __attribute__((cold, unused));
+#else
+# define ZEND_ATTRIBUTE_UNUSED
+# define ZEND_ATTRIBUTE_UNUSED_LABEL
+#endif
+
#if defined(__GNUC__) && ZEND_GCC_VERSION >= 3004 && defined(__i386__)
# define ZEND_FASTCALL __attribute__((fastcall))
#elif defined(_MSC_VER) && defined(_M_IX86)
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 0edff3e1a7..5770b9b030 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -262,7 +262,7 @@ static int parse_arg_object_to_string(zval *arg, char **p, int *pl, int type TSR
}
/* }}} */
-static int parse_arg_object_to_str(zval *arg, zend_string **str, int type TSRMLS_DC) /* {{{ */
+ZEND_API int parse_arg_object_to_str(zval *arg, zend_string **str, int type TSRMLS_DC) /* {{{ */
{
if (Z_OBJ_HANDLER_P(arg, cast_object)) {
zval obj;
@@ -300,6 +300,94 @@ static int parse_arg_object_to_str(zval *arg, zend_string **str, int type TSRMLS
}
/* }}} */
+#ifdef FAST_ZPP
+ZEND_API void zend_wrong_paramers_count_error(int num_args, int min_num_args, int max_num_args TSRMLS_DC) /* {{{ */
+{
+ zend_function *active_function = EG(current_execute_data)->func;
+ const char *class_name = active_function->common.scope ? active_function->common.scope->name->val : "";
+
+ zend_error(E_WARNING, "%s%s%s() expects %s %d parameter%s, %d given",
+ class_name, \
+ class_name[0] ? "::" : "", \
+ active_function->common.function_name->val,
+ min_num_args == max_num_args ? "exactly" : num_args < min_num_args ? "at least" : "at most",
+ num_args < min_num_args ? min_num_args : max_num_args,
+ (num_args < min_num_args ? min_num_args : max_num_args) == 1 ? "" : "s",
+ num_args);
+}
+/* }}} */
+
+ZEND_API void zend_wrong_paramer_type_error(int num, zend_expected_type expected_type, zval *arg TSRMLS_DC) /* {{{ */
+{
+ const char *space;
+ const char *class_name = get_active_class_name(&space TSRMLS_CC);
+ static const char * const expected_error[] = {
+ Z_EXPECTED_TYPES(Z_EXPECTED_TYPE_STR)
+ NULL
+ };
+
+ zend_error(E_WARNING, "%s%s%s() expects parameter %d to be %s, %s given",
+ class_name, space, get_active_function_name(TSRMLS_C), num, expected_error[expected_type], zend_zval_type_name(arg));
+}
+/* }}} */
+
+ZEND_API void zend_wrong_paramer_class_error(int num, char *name, zval *arg TSRMLS_DC) /* {{{ */
+{
+ const char *space;
+ const char *class_name = get_active_class_name(&space TSRMLS_CC);
+
+ zend_error(E_WARNING, "%s%s%s() expects parameter %d to be %s, %s given",
+ class_name, space, get_active_function_name(TSRMLS_C), num, name, zend_zval_type_name(arg));
+}
+/* }}} */
+
+ZEND_API void zend_wrong_callback_error(int severity, int num, char *error TSRMLS_DC) /* {{{ */
+{
+ const char *space;
+ const char *class_name = get_active_class_name(&space TSRMLS_CC);
+
+ zend_error(severity, "%s%s%s() expects parameter %d to be a valid callback, %s",
+ class_name, space, get_active_function_name(TSRMLS_C), num, error);
+ efree(error);
+}
+/* }}} */
+
+ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int check_null TSRMLS_CC) /* {{{ */
+{
+ zend_class_entry *ce_base = *pce;
+
+ if (check_null && Z_TYPE_P(arg) == IS_NULL) {
+ *pce = NULL;
+ return 1;
+ }
+ convert_to_string_ex(arg);
+ *pce = zend_lookup_class(Z_STR_P(arg) TSRMLS_CC);
+ if (ce_base) {
+ if ((!*pce || !instanceof_function(*pce, ce_base TSRMLS_CC))) {
+ const char *space;
+ const char *class_name = get_active_class_name(&space TSRMLS_CC);
+
+ zend_error(E_WARNING, "%s%s%s() expects parameter %d to be a class name derived from %s, '%s' given",
+ class_name, space, get_active_function_name(TSRMLS_C), num,
+ ce_base->name->val, Z_STRVAL_P(arg));
+ *pce = NULL;
+ return 0;
+ }
+ }
+ if (!*pce) {
+ const char *space;
+ const char *class_name = get_active_class_name(&space TSRMLS_CC);
+
+ zend_error(E_WARNING, "%s%s%s() expects parameter %d to be a valid class name, '%s' given",
+ class_name, space, get_active_function_name(TSRMLS_C), num,
+ Z_STRVAL_P(arg));
+ return 0;
+ }
+ return 1;
+}
+/* }}} */
+#endif
+
static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, const char **spec, char **error, int *severity TSRMLS_DC) /* {{{ */
{
const char *spec_walk = *spec;
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index beca63c50b..9278224c72 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -680,6 +680,610 @@ END_EXTERN_C()
#define ZEND_GINIT_FUNCTION ZEND_MODULE_GLOBALS_CTOR_D
#define ZEND_GSHUTDOWN_FUNCTION ZEND_MODULE_GLOBALS_DTOR_D
+/* Fast parameter parsing API */
+
+/* TODO: 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)
+ */
+#define FAST_ZPP 1
+
+#ifdef FAST_ZPP
+
+#define Z_EXPECTED_TYPES(_) \
+ _(Z_EXPECTED_LONG, "long") \
+ _(Z_EXPECTED_BOOL, "boolean") \
+ _(Z_EXPECTED_STRING, "string") \
+ _(Z_EXPECTED_ARRAY, "array") \
+ _(Z_EXPECTED_FUNC, "valid callback") \
+ _(Z_EXPECTED_RESOURCE, "resource") \
+ _(Z_EXPECTED_PATH, "a valid path") \
+ _(Z_EXPECTED_OBJECT, "object") \
+ _(Z_EXPECTED_DOUBLE, "double")
+
+#define Z_EXPECTED_TYPE_ENUM(id, str) id,
+#define Z_EXPECTED_TYPE_STR(id, str) str,
+
+typedef enum _zend_expected_type {
+ Z_EXPECTED_TYPES(Z_EXPECTED_TYPE_ENUM)
+ Z_EXPECTED_LAST
+} zend_expected_type;
+
+ZEND_API int parse_arg_object_to_str(zval *arg, zend_string **str, int type TSRMLS_DC);
+ZEND_API void zend_wrong_paramers_count_error(int num_args, int min_num_args, int max_num_args TSRMLS_DC);
+ZEND_API void zend_wrong_paramer_type_error(int num, zend_expected_type expected_type, zval *arg TSRMLS_DC);
+ZEND_API void zend_wrong_paramer_class_error(int num, char *name, zval *arg TSRMLS_DC);
+ZEND_API void zend_wrong_callback_error(int severity, int num, char *error TSRMLS_DC);
+ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int check_null TSRMLS_CC);
+
+#define ZEND_PARSE_PARAMETERS_START_EX(flags, min_num_args, max_num_args) do { \
+ const int _flags = (flags); \
+ int _min_num_args = (min_num_args); \
+ int _max_num_args = (max_num_args); \
+ int _num_args = EG(current_execute_data)->num_args; \
+ int _i; \
+ zval *_real_arg, *_arg; \
+ zend_expected_type _expected_type; \
+ char *_error; \
+ zend_bool _dummy; \
+ ((void)_i); \
+ ((void)_real_arg); \
+ ((void)_arg); \
+ ((void)_expected_type); \
+ ((void)_error); \
+ ((void)_dummy); \
+ if (UNEXPECTED(_num_args < _min_num_args) || \
+ (UNEXPECTED(_num_args > _max_num_args) && \
+ EXPECTED(_max_num_args >= 0))) { \
+ if (!(_flags & ZEND_PARSE_PARAMS_QUIET)) { \
+ zend_wrong_paramers_count_error(_num_args, _min_num_args, _max_num_args); \
+ } \
+ goto zend_parse_params_failure; \
+ } \
+ _i = 0; \
+ _real_arg = ZEND_CALL_ARG(EG(current_execute_data), 0);
+
+#define ZEND_PARSE_PARAMETERS_START(min_num_args, max_num_args) \
+ ZEND_PARSE_PARAMETERS_START_EX(0, min_num_args, max_num_args)
+
+#define ZEND_PARSE_PARAMETERS_END_EX(failure) \
+ if (0) { \
+zend_parse_params_wrong_callback: ZEND_ATTRIBUTE_UNUSED_LABEL \
+ if (!(_flags & ZEND_PARSE_PARAMS_QUIET)) { \
+ zend_wrong_callback_error(E_WARNING, _i, _error TSRMLS_DC); \
+ } \
+ goto zend_parse_params_failure; \
+zend_parse_params_wrong_class: ZEND_ATTRIBUTE_UNUSED_LABEL \
+ if (!(_flags & ZEND_PARSE_PARAMS_QUIET)) { \
+ zend_wrong_paramer_class_error(_i, _error, _arg TSRMLS_DC); \
+ } \
+ goto zend_parse_params_failure; \
+zend_parse_params_wrong_arg: ZEND_ATTRIBUTE_UNUSED_LABEL \
+ if (!(_flags & ZEND_PARSE_PARAMS_QUIET)) { \
+ zend_wrong_paramer_type_error(_i, _expected_type, _arg TSRMLS_DC); \
+ } \
+zend_parse_params_failure: ZEND_ATTRIBUTE_UNUSED_LABEL \
+ failure; \
+ } \
+ } while (0)
+
+#define ZEND_PARSE_PARAMETERS_END() \
+ ZEND_PARSE_PARAMETERS_END_EX(return)
+
+#define Z_PARAM_PROLOGUE(separate) \
+ if (UNEXPECTED(++_i >_num_args)) break; \
+ _real_arg++; \
+ _arg = _real_arg; \
+ ZVAL_DEREF(_arg); \
+ if (separate) { \
+ SEPARATE_ZVAL_NOREF(_arg); \
+ }
+
+/* old "|" */
+#define Z_PARAM_OPTIONAL
+
+/* old "a" */
+#define Z_PARAM_ARRAY_EX(dest, check_null, separate) do { \
+ Z_PARAM_PROLOGUE(separate); \
+ if (!_z_param_array(_arg, &dest, check_null, 0)) { \
+ _expected_type = Z_EXPECTED_ARRAY; \
+ goto zend_parse_params_wrong_arg; \
+ } \
+ } while (0);
+
+#define Z_PARAM_ARRAY(dest) \
+ Z_PARAM_ARRAY_EX(dest, 0, 0)
+
+/* old "A" */
+#define Z_PARAM_ARRAY_OR_OBJECT_EX(dest, check_null, separate) do { \
+ Z_PARAM_PROLOGUE(separate); \
+ if (!_z_param_array(_arg, &dest, check_null, 1)) { \
+ _expected_type = Z_EXPECTED_ARRAY; \
+ goto zend_parse_params_wrong_arg; \
+ } \
+ } while (0);
+
+#define Z_PARAM_ARRAY_OR_OBJECT(dest, check_null, separate) \
+ Z_PARAM_ARRAY_OR_OBJECT_EX(dest, 0, 0)
+
+/* old "b" */
+#define Z_PARAM_BOOL_EX(dest, is_null, check_null, separate) do { \
+ Z_PARAM_PROLOGUE(separate); \
+ if (!_z_param_bool(_arg, &dest, &is_null, check_null)) { \
+ _expected_type = Z_EXPECTED_BOOL; \
+ goto zend_parse_params_wrong_arg; \
+ } \
+ } while (0);
+
+#define Z_PARAM_BOOL(dest) \
+ Z_PARAM_BOOL_EX(dest, _dummy, 0, 0)
+
+/* old "C" */
+#define Z_PARAM_CLASS_EX(dest, check_null, separate) do { \
+ Z_PARAM_PROLOGUE(separate); \
+ if (!_z_param_class(_arg, &dest, _i, check_null TSRMLS_CC)) { \
+ goto zend_parse_params_failure; \
+ } \
+ } while (0);
+
+#define Z_PARAM_CLASS(dest) \
+ Z_PARAM_CLASS_EX(dest, 0, 0)
+
+/* old "d" */
+#define Z_PARAM_DOUBLE_EX(dest, is_null, check_null, separate) do { \
+ Z_PARAM_PROLOGUE(separate); \
+ if (!_z_param_double(_arg, &dest, &is_null, check_null)) { \
+ _expected_type = Z_EXPECTED_DOUBLE; \
+ goto zend_parse_params_wrong_arg; \
+ } \
+ } while (0);
+
+#define Z_PARAM_DOUBLE(dest) \
+ Z_PARAM_DOUBLE_EX(dest, _dummy, 0, 0)
+
+/* old "f" */
+#define Z_PARAM_FUNC_EX(dest_fci, dest_fcc, check_null, separate) do { \
+ Z_PARAM_PROLOGUE(separate); \
+ if (!_z_param_func(_arg, &dest_fci, &dest_fcc, check_null, &_error)) { \
+ if (!_error) { \
+ _expected_type = Z_EXPECTED_FUNC; \
+ goto zend_parse_params_wrong_arg; \
+ } else { \
+ goto zend_parse_params_wrong_callback; \
+ } \
+ } else if (_error) { \
+ zend_wrong_callback_error(E_STRICT, _i, _error TSRMLS_DC); \
+ } \
+ } while (0);
+
+#define Z_PARAM_FUNC(dest_fci, dest_fcc) \
+ Z_PARAM_FUNC_EX(dest_fci, dest_fcc, 0, 0)
+
+/* old "h" */
+#define Z_PARAM_ARRAY_HT_EX(dest, check_null, separate) do { \
+ Z_PARAM_PROLOGUE(separate); \
+ if (!_z_param_array_ht(_arg, &dest, check_null, 0)) { \
+ _expected_type = Z_EXPECTED_ARRAY; \
+ goto zend_parse_params_wrong_arg; \
+ } \
+ } while (0);
+
+#define Z_PARAM_ARRAY_HT(dest) \
+ Z_PARAM_ARRAY_HT_EX(dest, 0, 0)
+
+/* old "H" */
+#define Z_PARAM_ARRAY_OR_OBJECT_HT_EX(dest, check_null, separate) do { \
+ Z_PARAM_PROLOGUE(separate); \
+ if (!_z_param_array_ht(_arg, &dest, check_null, 1)) { \
+ _expected_type = Z_EXPECTED_ARRAY; \
+ goto zend_parse_params_wrong_arg; \
+ } \
+ } while (0);
+
+#define Z_PARAM_ARRAY_OR_OBJECT_HT(dest) \
+ Z_PARAM_ARRAY_OR_OBJECT_HT_EX(dest, 0, 0)
+
+/* old "l" */
+#define Z_PARAM_LONG_EX(dest, is_null, check_null, separate) do { \
+ Z_PARAM_PROLOGUE(separate); \
+ if (!_z_param_long(_arg, &dest, &is_null, check_null, 0)) { \
+ _expected_type = Z_EXPECTED_LONG; \
+ goto zend_parse_params_wrong_arg; \
+ } \
+ } while (0);
+
+#define Z_PARAM_LONG(dest) \
+ Z_PARAM_LONG_EX(dest, _dummy, 0, 0)
+
+/* old "L" */
+#define Z_PARAM_STRICT_LONG_EX(dest, is_null, check_null, separate) do { \
+ Z_PARAM_PROLOGUE(separate); \
+ if (!_z_param_long(_arg, &dest, &is_null, check_null, 1)) { \
+ _expected_type = Z_EXPECTED_LONG; \
+ goto zend_parse_params_wrong_arg; \
+ } \
+ } while (0);
+
+#define Z_PARAM_STRICT_LONG(dest) \
+ Z_PARAM_STRICT_LONG_EX(dest, _dummy, 0, 0)
+
+/* old "o" */
+#define Z_PARAM_OBJECT_EX(dest, check_null, separate) do { \
+ Z_PARAM_PROLOGUE(separate); \
+ if (!_z_param_object(_arg, &dest, NULL, check_null)) { \
+ _expected_type = Z_EXPECTED_OBJECT; \
+ goto zend_parse_params_wrong_arg; \
+ } \
+ } while (0);
+
+#define Z_PARAM_OBJECT(dest) \
+ Z_PARAM_OBJECT_EX(dest, 0, 0)
+
+/* old "O" */
+#define Z_PARAM_OBJECT_OF_CLASS_EX(dest, _ce, check_null, separate) do { \
+ Z_PARAM_PROLOGUE(separate); \
+ if (!_z_param_object(_arg, &dest, _ce, check_null)) { \
+ if (_ce) { \
+ _error = (_ce)->name->val; \
+ goto zend_parse_params_wrong_class; \
+ } else { \
+ _expected_type = Z_EXPECTED_OBJECT; \
+ goto zend_parse_params_wrong_arg; \
+ } \
+ } \
+ } while (0);
+
+#define Z_PARAM_OBJECT_OF_CLASS(dest, _ce) \
+ Z_PARAM_OBJECT_OF_CLASS_EX(dest, _ce, 0, 0)
+
+/* old "p" */
+#define Z_PARAM_PATH_EX(dest, dest_len, check_null, separate) do { \
+ Z_PARAM_PROLOGUE(separate); \
+ if (!_z_param_path(_arg, &dest, &dest_len, check_null)) { \
+ _expected_type = Z_EXPECTED_PATH; \
+ goto zend_parse_params_wrong_arg; \
+ } \
+ } while (0);
+
+#define Z_PARAM_PATH(dest, dest_len) \
+ Z_PARAM_PATH_EX(dest, dest_len, 0, 0)
+
+/* old "P" */
+#define Z_PARAM_PATH_STR_EX(dest, check_null, separate) do { \
+ Z_PARAM_PROLOGUE(separate); \
+ if (!_z_param_path_str(_arg, &dest, check_null)) { \
+ _expected_type = Z_EXPECTED_PATH; \
+ goto zend_parse_params_wrong_arg; \
+ } \
+ } while (0);
+
+#define Z_PARAM_PATH_STR(dest) \
+ Z_PARAM_PATH_STR_EX(dest, 0, 0)
+
+/* old "r" */
+#define Z_PARAM_RESOURCE_EX(dest, check_null, separate) do { \
+ Z_PARAM_PROLOGUE(separate); \
+ if (!_z_param_resource(_arg, &dest, check_null)) { \
+ _expected_type = Z_EXPECTED_RESOURCE; \
+ goto zend_parse_params_wrong_arg; \
+ } \
+ } while (0);
+
+#define Z_PARAM_RESOURCE(dest) \
+ Z_PARAM_RESOURCE_EX(dest, 0, 0)
+
+/* old "s" */
+#define Z_PARAM_STRING_EX(dest, dest_len, check_null, separate) do { \
+ Z_PARAM_PROLOGUE(separate); \
+ if (!_z_param_string(_arg, &dest, &dest_len, check_null)) { \
+ _expected_type = Z_EXPECTED_STRING; \
+ goto zend_parse_params_wrong_arg; \
+ } \
+ } while (0);
+
+#define Z_PARAM_STRING(dest, dest_len) \
+ Z_PARAM_STRING_EX(dest, dest_len, 0, 0)
+
+/* old "S" */
+#define Z_PARAM_STR_EX(dest, check_null, separate) do { \
+ Z_PARAM_PROLOGUE(separate); \
+ if (!_z_param_str(_arg, &dest, check_null)) { \
+ _expected_type = Z_EXPECTED_STRING; \
+ goto zend_parse_params_wrong_arg; \
+ } \
+ } while (0);
+
+#define Z_PARAM_STR(dest) \
+ Z_PARAM_STR_EX(dest, 0, 0)
+
+/* old "z" */
+#define Z_PARAM_ZVAL_EX(dest, check_null, separate) do { \
+ if (separate) { \
+ Z_PARAM_PROLOGUE(separate); \
+ _z_param_zval_deref(_arg, &dest, check_null); \
+ } else { \
+ if (UNEXPECTED(++_i >_num_args)) break; \
+ _real_arg++; \
+ _z_param_zval(_real_arg, &dest, check_null); \
+ } \
+ } while (0);
+
+#define Z_PARAM_ZVAL(dest) \
+ Z_PARAM_ZVAL_EX(dest, 0, 0)
+
+/* old "z" (with dereference) */
+#define Z_PARAM_ZVAL_DEREF_EX(dest, check_null, separate) do { \
+ Z_PARAM_PROLOGUE(separate); \
+ _z_param_zval_deref(_arg, &dest, check_null); \
+ } while (0);
+
+#define Z_PARAM_ZVAL_DEREF(dest) \
+ Z_PARAM_ZVAL_DEREF_EX(dest, 0, 0)
+
+/* old "+" and "*" */
+#define Z_PARAM_VARIADIC_EX(spec, dest, dest_num, post_varargs) do { \
+ int _num_varargs = _num_args - _i - (post_varargs); \
+ if (_num_varargs > 0) { \
+ dest = _real_arg + 1; \
+ dest_num = _num_varargs; \
+ _i += _num_varargs; \
+ _real_arg += _num_varargs; \
+ } else { \
+ dest = NULL; \
+ dest_num = 0; \
+ } \
+ } while (0);
+
+#define Z_PARAM_VARIADIC(spec, dest, dest_num) \
+ Z_PARAM_VARIADIC_EX(spec, dest, dest_num, 0)
+
+/* Private part of new parameter parsing API */
+
+static zend_always_inline int _z_param_bool(zval *arg, zend_bool *dest, zend_bool *is_null, int check_null)
+{
+ if (check_null) {
+ *is_null = 0;
+ }
+ if (EXPECTED(Z_TYPE_P(arg) == IS_TRUE)) {
+ *dest = 1;
+ } else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) {
+ if (check_null) {
+ *is_null = (Z_TYPE_P(arg) == IS_NULL);
+ }
+ *dest = 0;
+ } else if (EXPECTED(Z_TYPE_P(arg) <= IS_STRING)) {
+ *dest = zend_is_true(arg);
+ } else {
+ return 0;
+ }
+ return 1;
+}
+
+static zend_always_inline int _z_param_long(zval *arg, long *dest, zend_bool *is_null, int check_null, int strict)
+{
+ if (check_null) {
+ *is_null = 0;
+ }
+ if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) {
+ if (strict && UNEXPECTED(Z_DVAL_P(arg) > LONG_MAX)) {
+ *dest = LONG_MAX;
+ } else if (strict && UNEXPECTED(Z_DVAL_P(arg) < LONG_MIN)) {
+ *dest = LONG_MIN;
+ } else {
+ *dest = Z_LVAL_P(arg);
+ }
+ } else if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) {
+ *dest = zend_dval_to_lval(Z_DVAL_P(arg));
+ } else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
+ double d;
+ int type;
+
+ if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_LONG)) {
+ if (EXPECTED(type != 0)) {
+ if (strict && UNEXPECTED(d > LONG_MAX)) {
+ *dest = LONG_MAX;
+ } else if (strict && UNEXPECTED(d < LONG_MIN)) {
+ *dest = LONG_MIN;
+ } else {
+ *dest = zend_dval_to_lval(d);
+ }
+ } else {
+ return 0;
+ }
+ }
+ } else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) {
+ if (check_null) {
+ *is_null = (Z_TYPE_P(arg) == IS_NULL);
+ }
+ *dest = 0;
+ } else if (EXPECTED(Z_TYPE_P(arg) == IS_TRUE)) {
+ *dest = 1;
+ } else {
+ return 0;
+ }
+ return 1;
+}
+
+static zend_always_inline int _z_param_double(zval *arg, double *dest, zend_bool *is_null, int check_null)
+{
+ if (check_null) {
+ *is_null = 0;
+ }
+ if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) {
+ *dest = Z_DVAL_P(arg);
+ } else if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) {
+ *dest = (double)Z_LVAL_P(arg);
+ } else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
+ long l;
+ int type;
+
+ if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), &l, dest)) != IS_DOUBLE)) {
+ if (EXPECTED(type != 0)) {
+ *dest = (double)(l);
+ } else {
+ return 0;
+ }
+ }
+ } else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) {
+ if (check_null) {
+ *is_null = (Z_TYPE_P(arg) == IS_NULL);
+ }
+ *dest = 0.0;
+ } else if (EXPECTED(Z_TYPE_P(arg) == IS_TRUE)) {
+ *dest = 1.0;
+ } else {
+ return 0;
+ }
+ return 1;
+}
+
+static zend_always_inline int _z_param_str(zval *arg, zend_string **dest, int check_null)
+{
+ if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
+ *dest = Z_STR_P(arg);
+ } else if (EXPECTED(Z_TYPE_P(arg) < IS_STRING)) {
+ if (check_null && UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
+ *dest = NULL;
+ } else {
+ if (Z_COPYABLE_P(arg) && Z_REFCOUNT_P(arg) > 1) {
+ Z_DELREF_P(arg);
+ zval_copy_ctor_func(arg);
+ }
+ convert_to_string(arg);
+ *dest = Z_STR_P(arg);
+ }
+ } else if (UNEXPECTED(Z_TYPE_P(arg) != IS_OBJECT) ||
+ UNEXPECTED(parse_arg_object_to_str(arg, dest, IS_STRING TSRMLS_CC) != SUCCESS)) {
+ return 0;
+ }
+ return 1;
+}
+
+static zend_always_inline int _z_param_string(zval *arg, char **dest, int *dest_len, int check_null)
+{
+ zend_string *str;
+
+ if (!_z_param_str(arg, &str, check_null)) {
+ return 0;
+ }
+ if (check_null && UNEXPECTED(!str)) {
+ *dest = NULL;
+ *dest_len = 0;
+ } else {
+ *dest = str->val;
+ *dest_len = str->len;
+ }
+ return 1;
+}
+
+static zend_always_inline int _z_param_path_str(zval *arg, zend_string **dest, int check_null)
+{
+ if (!_z_param_str(arg, dest, check_null) ||
+ (check_null && UNEXPECTED(!(*dest)->val)) ||
+ UNEXPECTED(CHECK_NULL_PATH((*dest)->val, (*dest)->len))) {
+ return 0;
+ }
+ return 1;
+}
+
+static zend_always_inline int _z_param_path(zval *arg, char **dest, int *dest_len, int check_null)
+{
+ zend_string *str;
+
+ if (!_z_param_path_str(arg, &str, check_null)) {
+ return 0;
+ }
+ if (check_null && UNEXPECTED(!str)) {
+ *dest = NULL;
+ *dest_len = 0;
+ } else {
+ *dest = str->val;
+ *dest_len = str->len;
+ }
+ return 1;
+}
+
+static zend_always_inline int _z_param_array(zval *arg, zval **dest, int check_null, int or_object)
+{
+ if (EXPECTED(Z_TYPE_P(arg) == IS_ARRAY) ||
+ (or_object && EXPECTED(Z_TYPE_P(arg) == IS_OBJECT))) {
+ *dest = arg;
+ } else if (check_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
+ *dest = NULL;
+ } else {
+ return 0;
+ }
+ return 1;
+}
+
+static zend_always_inline int _z_param_array_ht(zval *arg, HashTable **dest, int check_null, int or_object)
+{
+ if (EXPECTED(Z_TYPE_P(arg) == IS_ARRAY)) {
+ *dest = Z_ARRVAL_P(arg);
+ } else if (or_object && EXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) {
+ *dest = Z_OBJ_HT_P(arg)->get_properties(arg TSRMLS_CC);
+ } else if (check_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
+ *dest = NULL;
+ } else {
+ return 0;
+ }
+ return 1;
+}
+
+static zend_always_inline int _z_param_object(zval *arg, zval **dest, zend_class_entry *ce, int check_null)
+{
+ if (EXPECTED(Z_TYPE_P(arg) == IS_OBJECT) &&
+ (!ce || EXPECTED(instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC) != 0))) {
+ *dest = arg;
+ } else if (check_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
+ *dest = NULL;
+ } else {
+ return 0;
+ }
+ return 1;
+}
+
+static zend_always_inline int _z_param_resource(zval *arg, zval **dest, int check_null)
+{
+ if (EXPECTED(Z_TYPE_P(arg) == IS_RESOURCE)) {
+ *dest = arg;
+ } else if (check_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
+ *dest = NULL;
+ } else {
+ return 0;
+ }
+ return 1;
+}
+
+static zend_always_inline int _z_param_func(zval *arg, zend_fcall_info *dest_fci, zend_fcall_info_cache *dest_fcc, int check_null, char **error)
+{
+ if (check_null && UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
+ dest_fci->size = 0;
+ dest_fcc->initialized = 0;
+ *error = NULL;
+ } else if (UNEXPECTED(zend_fcall_info_init(arg, 0, dest_fci, dest_fcc, NULL, error TSRMLS_CC) != SUCCESS)) {
+ return 0;
+ }
+ return 1;
+}
+
+static zend_always_inline void _z_param_zval(zval *arg, zval **dest, int check_null)
+{
+ *dest = (check_null &&
+ (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) ||
+ (UNEXPECTED(Z_ISREF_P(arg)) &&
+ UNEXPECTED(Z_TYPE_P(Z_REFVAL_P(arg)) == IS_NULL)))) ? NULL : arg;
+}
+
+static zend_always_inline void _z_param_zval_deref(zval *arg, zval **dest, int check_null)
+{
+ *dest = (check_null && UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) ? NULL : arg;
+}
+
+#endif /* FAST_ZPP */
+
+/* End of new parameter parsing API */
+
END_EXTERN_C()
#endif /* ZEND_API_H */
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 51265ecb40..1e29ea4db1 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -518,9 +518,15 @@ ZEND_FUNCTION(strlen)
{
zend_string *s;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &s) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(s)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
RETVAL_LONG(s->len);
}
@@ -697,9 +703,18 @@ ZEND_FUNCTION(define)
int case_sensitive = CONST_CS;
zend_constant c;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|b", &name, &val, &non_cs) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STR(name)
+ Z_PARAM_ZVAL(val)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(non_cs)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if(non_cs) {
case_sensitive = 0;
@@ -764,9 +779,15 @@ ZEND_FUNCTION(defined)
{
zend_string *name;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(name)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (zend_get_constant_ex(name, NULL, ZEND_FETCH_CLASS_SILENT TSRMLS_CC)) {
RETURN_TRUE;
@@ -869,9 +890,18 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
zend_bool allow_string = only_subclass;
zend_bool retval;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS|b", &obj, &class_name, &allow_string) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_ZVAL(obj)
+ Z_PARAM_STR(class_name)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(allow_string)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
/*
* allow_string - is_a default is no, is_subclass_of is yes.
* if it's allowed, then the autoloader will be called if the class does not exist.
@@ -1007,9 +1037,15 @@ ZEND_FUNCTION(get_object_vars)
uint prop_len;
zend_object *zobj;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_OBJECT(obj)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (Z_OBJ_HT_P(obj)->get_properties == NULL) {
RETURN_FALSE;
@@ -1124,9 +1160,16 @@ ZEND_FUNCTION(method_exists)
zend_string *lcname;
zend_class_entry * ce;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS", &klass, &method_name) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_ZVAL(klass)
+ Z_PARAM_STR(method_name)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (Z_TYPE_P(klass) == IS_OBJECT) {
ce = Z_OBJCE_P(klass);
} else if (Z_TYPE_P(klass) == IS_STRING) {
@@ -1227,9 +1270,17 @@ ZEND_FUNCTION(class_exists)
zend_class_entry *ce;
zend_bool autoload = 1;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &class_name, &autoload) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STR(class_name)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(autoload)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (!autoload) {
if (class_name->val[0] == '\\') {
@@ -1262,9 +1313,17 @@ ZEND_FUNCTION(interface_exists)
zend_class_entry *ce;
zend_bool autoload = 1;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &iface_name, &autoload) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STR(iface_name)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(autoload)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (!autoload) {
if (iface_name->val[0] == '\\') {
@@ -1297,9 +1356,17 @@ ZEND_FUNCTION(trait_exists)
zend_class_entry *ce;
zend_bool autoload = 1;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &trait_name, &autoload) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STR(trait_name)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(autoload)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (!autoload) {
if (trait_name->val[0] == '\\') {
@@ -1334,9 +1401,15 @@ ZEND_FUNCTION(function_exists)
zend_function *func;
zend_string *lcname;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(name, name_len)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (name[0] == '\\') {
/* Ignore leading "\" */
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 76c732732e..dc2756fe09 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -2561,6 +2561,10 @@ ZEND_API zend_string *zend_long_to_str(long num) /* {{{ */
}
/* }}} */
+ZEND_API zend_uchar is_numeric_str_function(const zend_string *str, long *lval, double *dval) {
+ return is_numeric_string_ex(str->val, str->len, lval, dval, -1, NULL);
+}
+
/*
* Local variables:
* tab-width: 4
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
index b952b9889e..1ab9518b9a 100644
--- a/Zend/zend_operators.h
+++ b/Zend/zend_operators.h
@@ -270,6 +270,8 @@ static inline zend_uchar is_numeric_string(const char *str, int length, long *lv
return is_numeric_string_ex(str, length, lval, dval, allow_errors, NULL);
}
+ZEND_API zend_uchar is_numeric_str_function(const zend_string *str, long *lval, double *dval);
+
static inline const char *
zend_memnstr(const char *haystack, const char *needle, int needle_len, char *end)
{
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);