GIF89a; EcchiShell v1.0
//opt/remi/php70/root/usr/include/get_properties((p)) : NULL))) #define ZVAL_IS_NULL(z) (Z_TYPE_P(z) == IS_NULL) /* For compatibility */ #define ZEND_MINIT ZEND_MODULE_STARTUP_N #define ZEND_MSHUTDOWN ZEND_MODULE_SHUTDOWN_N #define ZEND_RINIT ZEND_MODULE_ACTIVATE_N #define ZEND_RSHUTDOWN ZEND_MODULE_DEACTIVATE_N #define ZEND_MINFO ZEND_MODULE_INFO_N #define ZEND_GINIT(module) ((void (*)(void*))(ZEND_MODULE_GLOBALS_CTOR_N(module))) #define ZEND_GSHUTDOWN(module) ((void (*)(void*))(ZEND_MODULE_GLOBALS_DTOR_N(module))) #define ZEND_MINIT_FUNCTION ZEND_MODULE_STARTUP_D #define ZEND_MSHUTDOWN_FUNCTION ZEND_MODULE_SHUTDOWN_D #define ZEND_RINIT_FUNCTION ZEND_MODULE_ACTIVATE_D #define ZEND_RSHUTDOWN_FUNCTION ZEND_MODULE_DEACTIVATE_D #define ZEND_MINFO_FUNCTION ZEND_MODULE_INFO_D #define ZEND_GINIT_FUNCTION ZEND_MODULE_GLOBALS_CTOR_D #define ZEND_GSHUTDOWN_FUNCTION ZEND_MODULE_GLOBALS_DTOR_D /* Fast parameter parsing API */ /* Fast ZPP is always enabled now; this define is left in for compatibility * with any existing conditional compilation blocks. */ #define FAST_ZPP 1 #define Z_EXPECTED_TYPES(_) \ _(Z_EXPECTED_LONG, "integer") \ _(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, "float") #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 ZEND_COLD void ZEND_FASTCALL zend_wrong_paramers_count_error(int num_args, int min_num_args, int max_num_args); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_paramer_type_error(int num, zend_expected_type expected_type, zval *arg); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_paramer_class_error(int num, char *name, zval *arg); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(int severity, int num, char *error); #define ZPP_ERROR_OK 0 #define ZPP_ERROR_FAILURE 1 #define ZPP_ERROR_WRONG_CALLBACK 2 #define ZPP_ERROR_WRONG_CLASS 3 #define ZPP_ERROR_WRONG_ARG 4 #define ZPP_ERROR_WRONG_COUNT 5 #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 = EX_NUM_ARGS(); \ int _i; \ zval *_real_arg, *_arg = NULL; \ zend_expected_type _expected_type = Z_EXPECTED_LONG; \ char *_error = NULL; \ zend_bool _dummy; \ zend_bool _optional = 0; \ int error_code = ZPP_ERROR_OK; \ ((void)_i); \ ((void)_real_arg); \ ((void)_arg); \ ((void)_expected_type); \ ((void)_error); \ ((void)_dummy); \ ((void)_optional); \ \ do { \ 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); \ } \ error_code = ZPP_ERROR_FAILURE; \ break; \ } \ _i = 0; \ _real_arg = ZEND_CALL_ARG(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) \ } while (0); \ if (UNEXPECTED(error_code != ZPP_ERROR_OK)) { \ if (!(_flags & ZEND_PARSE_PARAMS_QUIET)) { \ if (error_code == ZPP_ERROR_WRONG_CALLBACK) { \ zend_wrong_callback_error(E_WARNING, _i, _error); \ } else if (error_code == ZPP_ERROR_WRONG_CLASS) { \ zend_wrong_paramer_class_error(_i, _error, _arg); \ } else if (error_code == ZPP_ERROR_WRONG_ARG) { \ zend_wrong_paramer_type_error(_i, _expected_type, _arg); \ } \ } \ failure; \ } \ } while (0) #define ZEND_PARSE_PARAMETERS_END() \ ZEND_PARSE_PARAMETERS_END_EX(return) #define Z_PARAM_PROLOGUE(separate) \ ++_i; \ ZEND_ASSERT(_i <= _min_num_args || _optional==1); \ ZEND_ASSERT(_i > _min_num_args || _optional==0); \ if (_optional) { \ 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 \ _optional = 1; /* old "a" */ #define Z_PARAM_ARRAY_EX(dest, check_null, separate) \ Z_PARAM_PROLOGUE(separate); \ if (UNEXPECTED(!zend_parse_arg_array(_arg, &dest, check_null, 0))) { \ _expected_type = Z_EXPECTED_ARRAY; \ error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } #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) \ Z_PARAM_PROLOGUE(separate); \ if (UNEXPECTED(!zend_parse_arg_array(_arg, &dest, check_null, 1))) { \ _expected_type = Z_EXPECTED_ARRAY; \ error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } #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) \ Z_PARAM_PROLOGUE(separate); \ if (UNEXPECTED(!zend_parse_arg_bool(_arg, &dest, &is_null, check_null))) { \ _expected_type = Z_EXPECTED_BOOL; \ error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } #define Z_PARAM_BOOL(dest) \ Z_PARAM_BOOL_EX(dest, _dummy, 0, 0) /* old "C" */ #define Z_PARAM_CLASS_EX(dest, check_null, separate) \ Z_PARAM_PROLOGUE(separate); \ if (UNEXPECTED(!zend_parse_arg_class(_arg, &dest, _i, check_null))) { \ error_code = ZPP_ERROR_FAILURE; \ break; \ } #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) \ Z_PARAM_PROLOGUE(separate); \ if (UNEXPECTED(!zend_parse_arg_double(_arg, &dest, &is_null, check_null))) { \ _expected_type = Z_EXPECTED_DOUBLE; \ error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } #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) \ Z_PARAM_PROLOGUE(separate); \ if (UNEXPECTED(!zend_parse_arg_func(_arg, &dest_fci, &dest_fcc, check_null, &_error))) { \ if (!_error) { \ _expected_type = Z_EXPECTED_FUNC; \ error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } else { \ error_code = ZPP_ERROR_WRONG_CALLBACK; \ break; \ } \ } else if (UNEXPECTED(_error != NULL)) { \ zend_wrong_callback_error(E_DEPRECATED, _i, _error); \ } #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) \ Z_PARAM_PROLOGUE(separate); \ if (UNEXPECTED(!zend_parse_arg_array_ht(_arg, &dest, check_null, 0))) { \ _expected_type = Z_EXPECTED_ARRAY; \ error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } #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) \ Z_PARAM_PROLOGUE(separate); \ if (UNEXPECTED(!zend_parse_arg_array_ht(_arg, &dest, check_null, 1))) { \ _expected_type = Z_EXPECTED_ARRAY; \ error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } #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) \ Z_PARAM_PROLOGUE(separate); \ if (UNEXPECTED(!zend_parse_arg_long(_arg, &dest, &is_null, check_null, 0))) { \ _expected_type = Z_EXPECTED_LONG; \ error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } #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) \ Z_PARAM_PROLOGUE(separate); \ if (UNEXPECTED(!zend_parse_arg_long(_arg, &dest, &is_null, check_null, 1))) { \ _expected_type = Z_EXPECTED_LONG; \ error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } #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) \ Z_PARAM_PROLOGUE(separate); \ if (UNEXPECTED(!zend_parse_arg_object(_arg, &dest, NULL, check_null))) { \ _expected_type = Z_EXPECTED_OBJECT; \ error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } #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) \ Z_PARAM_PROLOGUE(separate); \ if (UNEXPECTED(!zend_parse_arg_object(_arg, &dest, _ce, check_null))) { \ if (_ce) { \ _error = ZSTR_VAL((_ce)->name); \ error_code = ZPP_ERROR_WRONG_CLASS; \ break; \ } else { \ _expected_type = Z_EXPECTED_OBJECT; \ error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } \ } #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) \ Z_PARAM_PROLOGUE(separate); \ if (UNEXPECTED(!zend_parse_arg_path(_arg, &dest, &dest_len, check_null))) { \ _expected_type = Z_EXPECTED_PATH; \ error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } #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) \ Z_PARAM_PROLOGUE(separate); \ if (UNEXPECTED(!zend_parse_arg_path_str(_arg, &dest, check_null))) { \ _expected_type = Z_EXPECTED_PATH; \ error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } #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) \ Z_PARAM_PROLOGUE(separate); \ if (UNEXPECTED(!zend_parse_arg_resource(_arg, &dest, check_null))) { \ _expected_type = Z_EXPECTED_RESOURCE; \ error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } #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) \ Z_PARAM_PROLOGUE(separate); \ if (UNEXPECTED(!zend_parse_arg_string(_arg, &dest, &dest_len, check_null))) { \ _expected_type = Z_EXPECTED_STRING; \ error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } #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) \ Z_PARAM_PROLOGUE(separate); \ if (UNEXPECTED(!zend_parse_arg_str(_arg, &dest, check_null))) { \ _expected_type = Z_EXPECTED_STRING; \ error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } #define Z_PARAM_STR(dest) \ Z_PARAM_STR_EX(dest, 0, 0) /* old "z" */ #define Z_PARAM_ZVAL_EX(dest, check_null, separate) \ if (separate) { \ Z_PARAM_PROLOGUE(separate); \ zend_parse_arg_zval_deref(_arg, &dest, check_null); \ } else { \ ++_i; \ ZEND_ASSERT(_i <= _min_num_args || _optional==1); \ ZEND_ASSERT(_i > _min_num_args || _optional==0); \ if (_optional && UNEXPECTED(_i >_num_args)) break; \ _real_arg++; \ zend_parse_arg_zval(_real_arg, &dest, check_null); \ } #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) \ Z_PARAM_PROLOGUE(separate); \ zend_parse_arg_zval_deref(_arg, &dest, check_null); #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 (EXPECTED(_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) /* End of new parameter parsing API */ /* Inlined implementations shared by new and old parameter parsing APIs */ ZEND_API int ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pce, int num, int check_null); ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, zend_bool *dest); ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, zend_bool *dest); ZEND_API int ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest); ZEND_API int ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest); ZEND_API int ZEND_FASTCALL zend_parse_arg_long_cap_slow(zval *arg, zend_long *dest); ZEND_API int ZEND_FASTCALL zend_parse_arg_long_cap_weak(zval *arg, zend_long *dest); ZEND_API int ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest); ZEND_API int ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest); ZEND_API int ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest); ZEND_API int ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest); static zend_always_inline int zend_parse_arg_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_FALSE)) { *dest = 0; } else if (check_null && Z_TYPE_P(arg) == IS_NULL) { *is_null = 1; *dest = 0; } else { return zend_parse_arg_bool_slow(arg, dest); } return 1; } static zend_always_inline int zend_parse_arg_long(zval *arg, zend_long *dest, zend_bool *is_null, int check_null, int cap) { if (check_null) { *is_null = 0; } if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) { *dest = Z_LVAL_P(arg); } else if (check_null && Z_TYPE_P(arg) == IS_NULL) { *is_null = 1; *dest = 0; } else if (cap) { return zend_parse_arg_long_cap_slow(arg, dest); } else { return zend_parse_arg_long_slow(arg, dest); } return 1; } static zend_always_inline int zend_parse_arg_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 (check_null && Z_TYPE_P(arg) == IS_NULL) { *is_null = 1; *dest = 0.0; } else { return zend_parse_arg_double_slow(arg, dest); } return 1; } static zend_always_inline int zend_parse_arg_str(zval *arg, zend_string **dest, int check_null) { if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) { *dest = Z_STR_P(arg); } else if (check_null && Z_TYPE_P(arg) == IS_NULL) { *dest = NULL; } else { return zend_parse_arg_str_slow(arg, dest); } return 1; } static zend_always_inline int zend_parse_arg_string(zval *arg, char **dest, size_t *dest_len, int check_null) { zend_string *str; if (!zend_parse_arg_str(arg, &str, check_null)) { return 0; } if (check_null && UNEXPECTED(!str)) { *dest = NULL; *dest_len = 0; } else { *dest = ZSTR_VAL(str); *dest_len = ZSTR_LEN(str); } return 1; } static zend_always_inline int zend_parse_arg_path_str(zval *arg, zend_string **dest, int check_null) { if (!zend_parse_arg_str(arg, dest, check_null) || (*dest && UNEXPECTED(CHECK_NULL_PATH(ZSTR_VAL(*dest), ZSTR_LEN(*dest))))) { return 0; } return 1; } static zend_always_inline int zend_parse_arg_path(zval *arg, char **dest, size_t *dest_len, int check_null) { zend_string *str; if (!zend_parse_arg_path_str(arg, &str, check_null)) { return 0; } if (check_null && UNEXPECTED(!str)) { *dest = NULL; *dest_len = 0; } else { *dest = ZSTR_VAL(str); *dest_len = ZSTR_LEN(str); } return 1; } static zend_always_inline int zend_parse_arg_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 zend_parse_arg_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); } else if (check_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) { *dest = NULL; } else { return 0; } return 1; } static zend_always_inline int zend_parse_arg_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) != 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 zend_parse_arg_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 zend_parse_arg_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) != SUCCESS)) { return 0; } return 1; } static zend_always_inline void zend_parse_arg_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 zend_parse_arg_zval_deref(zval *arg, zval **dest, int check_null) { *dest = (check_null && UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) ? NULL : arg; } END_EXTERN_C() #endif /* ZEND_API_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: */