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 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)
}
/* }}} */
-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;
}
/* }}} */
+#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;
#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 */
{
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);
}
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;
{
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;
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.
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;
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) {
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] == '\\') {
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] == '\\') {
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] == '\\') {
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 "\" */
}
/* }}} */
+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
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)
{
long flags = 0; /* Match control flags */
long start_offset = 0; /* Where the new search starts */
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ss|z/ll", ®ex,
&subject, &subject_len, &subpats, &flags, &start_offset) == FAILURE) {
RETURN_FALSE;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, 5)
+ Z_PARAM_STR(regex)
+ Z_PARAM_STRING(subject, subject_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_EX(subpats, 0, 1)
+ Z_PARAM_LONG(flags)
+ Z_PARAM_LONG(start_offset)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+#endif
/* Compile regex or get it from cache. */
if ((pce = pcre_get_compiled_regex_cache(regex TSRMLS_CC)) == NULL) {
zend_string *callback_name;
int replace_count=0, old_replace_count;
+#ifndef FAST_ZPP
/* Get function parameters and do error-checking. */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzz|lz/", ®ex, &replace, &subject, &limit, &zcount) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(3, 5)
+ Z_PARAM_ZVAL(regex)
+ Z_PARAM_ZVAL(replace)
+ Z_PARAM_ZVAL(subject)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(limit)
+ Z_PARAM_ZVAL_EX(zcount, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
if (!is_callable_replace && Z_TYPE_P(replace) == IS_ARRAY && Z_TYPE_P(regex) != IS_ARRAY) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter mismatch, pattern is a string while replacement is an array");
pcre_cache_entry *pce; /* Compiled regular expression */
/* Get function parameters and do error checking */
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ss|ll", ®ex,
&subject, &subject_len, &limit_val, &flags) == FAILURE) {
RETURN_FALSE;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, 4)
+ Z_PARAM_STR(regex)
+ Z_PARAM_STRING(subject, subject_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(limit_val)
+ Z_PARAM_LONG(flags)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+#endif
/* Compile regex or get it from cache. */
if ((pce = pcre_get_compiled_regex_cache(regex TSRMLS_CC)) == NULL) {
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;
pcre_cache_entry *pce; /* Compiled regular expression */
/* Get arguments and do error checking */
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sa|l", ®ex,
&input, &flags) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STR(regex)
+ Z_PARAM_ARRAY(input)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(flags)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
/* Compile regex or get it from cache. */
if ((pce = pcre_get_compiled_regex_cache(regex TSRMLS_CC)) == NULL) {
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));
}
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);
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;
}
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:
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);
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);
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);
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);
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;
{
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);
}
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;
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) {
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;
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));
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;
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;
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();
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:
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;
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, ¶ms) == 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;
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);
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)) {
/* 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; \
\
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)
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);
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,
"e_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);
{
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));
}
/* }}} */
{
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));
}
/* }}} */
{
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));
}
/* }}} */
{
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));
}
/* }}} */
{
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));
}
/* }}} */
{
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));
}
/* }}} */
{
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));
}
/* }}} */
{
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));
}
/* }}} */
{
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));
}
/* }}} */
{
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));
}
/* }}} */
{
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));
}
/* }}} */
{
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));
}
/* }}} */
{
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));
}
/* }}} */
{
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));
}
/* }}} */
{
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));
}
/* }}} */
{
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));
}
/* }}} */
{
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));
}
{
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));
}
/* }}} */
{
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));
}
/* }}} */
{
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));
}
{
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));
}
/* }}} */
{
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));
}
/* }}} */
{
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)
{
double deg;
+#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", °) == 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);
}
/* }}} */
{
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);
}
/* }}} */
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:
{
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));
}
/* }}} */
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);
}
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");
{
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) {
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);
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");
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);
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)) {
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]);
}
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();
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();
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");
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();
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) {
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);
}
/* }}} */
-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;
{
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:
{
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));
}
{
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);
{
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));
}
{
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);