diff options
Diffstat (limited to 'ext/reflection')
118 files changed, 2170 insertions, 1967 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 386130a307..a97331d53a 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1,7 +1,5 @@ /* +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | @@ -43,6 +41,7 @@ #include "zend_extensions.h" #include "zend_builtin_functions.h" #include "zend_smart_str.h" +#include "reflection_arginfo.h" /* Key used to avoid leaking addresses in ReflectionProperty::getId() */ #define REFLECTION_KEY_LEN 16 @@ -76,6 +75,7 @@ PHPAPI zend_class_entry *reflection_generator_ptr; PHPAPI zend_class_entry *reflection_parameter_ptr; PHPAPI zend_class_entry *reflection_type_ptr; PHPAPI zend_class_entry *reflection_named_type_ptr; +PHPAPI zend_class_entry *reflection_union_type_ptr; PHPAPI zend_class_entry *reflection_class_ptr; PHPAPI zend_class_entry *reflection_object_ptr; PHPAPI zend_class_entry *reflection_method_ptr; @@ -93,10 +93,10 @@ PHPAPI zend_class_entry *reflection_reference_ptr; intern = Z_REFLECTION_P(ZEND_THIS); \ if (intern->ptr == NULL) { \ if (EG(exception) && EG(exception)->ce == reflection_exception_ptr) { \ - return; \ + RETURN_THROWS(); \ } \ zend_throw_error(NULL, "Internal error: Failed to retrieve the reflection object"); \ - return; \ + RETURN_THROWS(); \ } \ } while (0) @@ -113,9 +113,8 @@ PHPAPI zend_class_entry *reflection_reference_ptr; /* Struct for properties */ typedef struct _property_reference { - zend_property_info prop; + zend_property_info *prop; zend_string *unmangled_name; - zend_bool dynamic; } property_reference; /* Struct for parameters */ @@ -129,6 +128,8 @@ typedef struct _parameter_reference { /* Struct for type hints */ typedef struct _type_reference { zend_type type; + /* Whether to use backwards compatible null representation */ + zend_bool legacy_behavior; } type_reference; typedef enum { @@ -160,6 +161,10 @@ static inline reflection_object *reflection_object_from_obj(zend_object *obj) { static zend_object_handlers reflection_object_handlers; +static uint32_t zend_always_inline prop_get_flags(property_reference *ref) { + return ref->prop ? ref->prop->flags : ZEND_ACC_PUBLIC; +} + static inline zend_bool is_closure_invoke(zend_class_entry *ce, zend_string *lcname) { return ce == zend_ce_closure && zend_string_equals_literal(lcname, ZEND_INVOKE_FUNC_NAME); @@ -226,7 +231,14 @@ static void reflection_free_objects_storage(zend_object *object) /* {{{ */ case REF_TYPE_TYPE: { type_reference *type_ref = intern->ptr; - if (ZEND_TYPE_IS_NAME(type_ref->type)) { + if (ZEND_TYPE_HAS_LIST(type_ref->type)) { + void *entry; + ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(type_ref->type), entry) { + if (ZEND_TYPE_LIST_IS_NAME(entry)) { + zend_string_release(ZEND_TYPE_LIST_GET_NAME(entry)); + } + } ZEND_TYPE_LIST_FOREACH_END(); + } else if (ZEND_TYPE_HAS_NAME(type_ref->type)) { zend_string_release(ZEND_TYPE_NAME(type_ref->type)); } efree(type_ref); @@ -252,9 +264,9 @@ static void reflection_free_objects_storage(zend_object *object) /* {{{ */ } /* }}} */ -static HashTable *reflection_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */ +static HashTable *reflection_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */ { - reflection_object *intern = Z_REFLECTION_P(obj); + reflection_object *intern = reflection_object_from_obj(obj); *gc_data = &intern->obj; *gc_data_count = 1; return zend_std_get_properties(obj); @@ -281,7 +293,7 @@ static zval *reflection_instantiate(zend_class_entry *pce, zval *object) /* {{{ static void _const_string(smart_str *str, char *name, zval *value, char *indent); static void _function_string(smart_str *str, zend_function *fptr, zend_class_entry *scope, char* indent); -static void _property_string(smart_str *str, zend_property_info *prop, const char *prop_name, char* indent, zend_bool dynamic); +static void _property_string(smart_str *str, zend_property_info *prop, const char *prop_name, char* indent); static void _class_const_string(smart_str *str, char *name, zend_class_constant *c, char* indent); static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char *indent); static void _extension_string(smart_str *str, zend_module_entry *module, char *indent); @@ -396,7 +408,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop) { if ((prop->flags & ZEND_ACC_STATIC) && (!(prop->flags & ZEND_ACC_PRIVATE) || prop->ce == ce)) { - _property_string(str, prop, NULL, ZSTR_VAL(sub_indent), 0); + _property_string(str, prop, NULL, ZSTR_VAL(sub_indent)); } } ZEND_HASH_FOREACH_END(); } @@ -444,14 +456,14 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop) { if (!(prop->flags & ZEND_ACC_STATIC) && (!(prop->flags & ZEND_ACC_PRIVATE) || prop->ce == ce)) { - _property_string(str, prop, NULL, ZSTR_VAL(sub_indent), 0); + _property_string(str, prop, NULL, ZSTR_VAL(sub_indent)); } } ZEND_HASH_FOREACH_END(); } smart_str_append_printf(str, "%s }\n", indent); if (obj && Z_TYPE_P(obj) == IS_OBJECT) { - HashTable *properties = Z_OBJ_HT_P(obj)->get_properties(obj); + HashTable *properties = Z_OBJ_HT_P(obj)->get_properties(Z_OBJ_P(obj)); zend_string *prop_name; smart_str prop_str = {0}; @@ -461,7 +473,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char if (prop_name && ZSTR_LEN(prop_name) && ZSTR_VAL(prop_name)[0]) { /* skip all private and protected properties */ if (!zend_hash_exists(&ce->properties_info, prop_name)) { count++; - _property_string(&prop_str, NULL, ZSTR_VAL(prop_name), ZSTR_VAL(sub_indent), 0); + _property_string(&prop_str, NULL, ZSTR_VAL(prop_name), ZSTR_VAL(sub_indent)); } } } ZEND_HASH_FOREACH_END(); @@ -518,7 +530,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char /* {{{ _const_string */ static void _const_string(smart_str *str, char *name, zval *value, char *indent) { - char *type = zend_zval_type_name(value); + const char *type = zend_zval_type_name(value); if (Z_TYPE_P(value) == IS_ARRAY) { smart_str_append_printf(str, "%s Constant [ %s %s ] { Array }\n", @@ -540,7 +552,7 @@ static void _const_string(smart_str *str, char *name, zval *value, char *indent) static void _class_const_string(smart_str *str, char *name, zend_class_constant *c, char *indent) { char *visibility = zend_visibility_string(Z_ACCESS_FLAGS(c->value)); - char *type; + const char *type; zval_update_constant_ex(&c->value, c->ce); type = zend_zval_type_name(&c->value); @@ -588,22 +600,15 @@ static void _parameter_string(smart_str *str, zend_function *fptr, struct _zend_ } else { smart_str_append_printf(str, "<required> "); } - if (ZEND_TYPE_IS_CLASS(arg_info->type)) { - smart_str_append_printf(str, "%s ", - ZSTR_VAL(ZEND_TYPE_NAME(arg_info->type))); - if (ZEND_TYPE_ALLOW_NULL(arg_info->type)) { - smart_str_append_printf(str, "or NULL "); - } - } else if (ZEND_TYPE_IS_CODE(arg_info->type)) { - smart_str_append_printf(str, "%s ", zend_get_type_by_const(ZEND_TYPE_CODE(arg_info->type))); - if (ZEND_TYPE_ALLOW_NULL(arg_info->type)) { - smart_str_append_printf(str, "or NULL "); - } + if (ZEND_TYPE_IS_SET(arg_info->type)) { + zend_string *type_str = zend_type_to_string(arg_info->type); + smart_str_append_printf(str, "%s ", ZSTR_VAL(type_str)); + zend_string_release(type_str); } - if (arg_info->pass_by_reference) { + if (ZEND_ARG_SEND_MODE(arg_info)) { smart_str_appendc(str, '&'); } - if (arg_info->is_variadic) { + if (ZEND_ARG_IS_VARIADIC(arg_info)) { smart_str_appends(str, "..."); } if (arg_info->name) { @@ -808,17 +813,10 @@ static void _function_string(smart_str *str, zend_function *fptr, zend_class_ent smart_str_free(¶m_indent); if (fptr->op_array.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) { smart_str_append_printf(str, " %s- Return [ ", indent); - if (ZEND_TYPE_IS_CLASS(fptr->common.arg_info[-1].type)) { - smart_str_append_printf(str, "%s ", - ZSTR_VAL(ZEND_TYPE_NAME(fptr->common.arg_info[-1].type))); - if (ZEND_TYPE_ALLOW_NULL(fptr->common.arg_info[-1].type)) { - smart_str_appends(str, "or NULL "); - } - } else if (ZEND_TYPE_IS_CODE(fptr->common.arg_info[-1].type)) { - smart_str_append_printf(str, "%s ", zend_get_type_by_const(ZEND_TYPE_CODE(fptr->common.arg_info[-1].type))); - if (ZEND_TYPE_ALLOW_NULL(fptr->common.arg_info[-1].type)) { - smart_str_appends(str, "or NULL "); - } + if (ZEND_TYPE_IS_SET(fptr->common.arg_info[-1].type)) { + zend_string *type_str = zend_type_to_string(fptr->common.arg_info[-1].type); + smart_str_append_printf(str, "%s ", ZSTR_VAL(type_str)); + zend_string_release(type_str); } smart_str_appends(str, "]\n"); } @@ -827,18 +825,14 @@ static void _function_string(smart_str *str, zend_function *fptr, zend_class_ent /* }}} */ /* {{{ _property_string */ -static void _property_string(smart_str *str, zend_property_info *prop, const char *prop_name, char* indent, zend_bool dynamic) +static void _property_string(smart_str *str, zend_property_info *prop, const char *prop_name, char* indent) { smart_str_append_printf(str, "%sProperty [ ", indent); if (!prop) { smart_str_append_printf(str, "<dynamic> public $%s", prop_name); } else { if (!(prop->flags & ZEND_ACC_STATIC)) { - if (dynamic) { - smart_str_appends(str, "<implicit> "); - } else { - smart_str_appends(str, "<default> "); - } + smart_str_appends(str, "<default> "); } /* These are mutually exclusive */ @@ -1064,7 +1058,7 @@ static void _function_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask) zend_function *mptr; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(mptr); RETURN_BOOL(mptr->common.fn_flags & mask); @@ -1146,22 +1140,50 @@ static void reflection_parameter_factory(zend_function *fptr, zval *closure_obje } /* }}} */ +/* For backwards compatibility reasons, we need to return T|null style unions + * as a ReflectionNamedType. Here we determine what counts as a union type and + * what doesn't. */ +static zend_bool is_union_type(zend_type type) { + if (ZEND_TYPE_HAS_LIST(type)) { + return 1; + } + uint32_t type_mask_without_null = ZEND_TYPE_PURE_MASK_WITHOUT_NULL(type); + if (ZEND_TYPE_HAS_CLASS(type)) { + return type_mask_without_null != 0; + } + if (type_mask_without_null == MAY_BE_BOOL) { + return 0; + } + /* Check that only one bit is set. */ + return (type_mask_without_null & (type_mask_without_null - 1)) != 0; +} + /* {{{ reflection_type_factory */ -static void reflection_type_factory(zend_type type, zval *object) +static void reflection_type_factory(zend_type type, zval *object, zend_bool legacy_behavior) { reflection_object *intern; type_reference *reference; + zend_bool is_union = is_union_type(type); - reflection_instantiate(reflection_named_type_ptr, object); + reflection_instantiate( + is_union ? reflection_union_type_ptr : reflection_named_type_ptr, object); intern = Z_REFLECTION_P(object); reference = (type_reference*) emalloc(sizeof(type_reference)); reference->type = type; + reference->legacy_behavior = legacy_behavior && !is_union; intern->ptr = reference; intern->ref_type = REF_TYPE_TYPE; /* Property types may be resolved during the lifetime of the ReflectionType, * so we need to make sure that the strings we reference are not released. */ - if (ZEND_TYPE_IS_NAME(type)) { + if (ZEND_TYPE_HAS_LIST(type)) { + void *entry; + ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(type), entry) { + if (ZEND_TYPE_LIST_IS_NAME(entry)) { + zend_string_addref(ZEND_TYPE_LIST_GET_NAME(entry)); + } + } ZEND_TYPE_LIST_FOREACH_END(); + } else if (ZEND_TYPE_HAS_NAME(type)) { zend_string_addref(ZEND_TYPE_NAME(type)); } } @@ -1207,47 +1229,29 @@ static void reflection_method_factory(zend_class_entry *ce, zend_function *metho /* }}} */ /* {{{ reflection_property_factory */ -static void reflection_property_factory(zend_class_entry *ce, zend_string *name, zend_property_info *prop, zval *object, zend_bool dynamic) +static void reflection_property_factory(zend_class_entry *ce, zend_string *name, zend_property_info *prop, zval *object) { reflection_object *intern; property_reference *reference; - if (!(prop->flags & ZEND_ACC_PRIVATE)) { - /* we have to search the class hierarchy for this (implicit) public or protected property */ - zend_class_entry *tmp_ce = ce, *store_ce = ce; - zend_property_info *tmp_info = NULL; - - while (tmp_ce && (tmp_info = zend_hash_find_ptr(&tmp_ce->properties_info, name)) == NULL) { - ce = tmp_ce; - tmp_ce = tmp_ce->parent; - } - - if (tmp_info && (!(tmp_info->flags & ZEND_ACC_PRIVATE) || tmp_info->ce == tmp_ce)) { /* found something and it's not a parent's private */ - prop = tmp_info; - } else { /* not found, use initial value */ - ce = store_ce; - } - } - reflection_instantiate(reflection_property_ptr, object); intern = Z_REFLECTION_P(object); reference = (property_reference*) emalloc(sizeof(property_reference)); - reference->prop = *prop; + reference->prop = prop; reference->unmangled_name = zend_string_copy(name); - reference->dynamic = dynamic; intern->ptr = reference; intern->ref_type = REF_TYPE_PROPERTY; intern->ce = ce; intern->ignore_visibility = 0; ZVAL_STR_COPY(reflection_prop_name(object), name); - ZVAL_STR_COPY(reflection_prop_class(object), prop->ce->name); + ZVAL_STR_COPY(reflection_prop_class(object), prop ? prop->ce->name : ce->name); } /* }}} */ static void reflection_property_factory_str(zend_class_entry *ce, const char *name_str, size_t name_len, zend_property_info *prop, zval *object) { zend_string *name = zend_string_init(name_str, name_len, 0); - reflection_property_factory(ce, name, prop, object, 0); + reflection_property_factory(ce, name, prop, object); zend_string_release(name); } @@ -1279,7 +1283,7 @@ static void reflection_export_impl(zval *return_value, zval *object, zend_bool r if (result == FAILURE) { _DO_THROW("Invocation of method __toString() failed"); - return; + RETURN_THROWS(); } if (Z_TYPE(retval) == IS_UNDEF) { @@ -1310,13 +1314,13 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c if (ctor_argc == 1) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &argument_ptr, &return_output) == FAILURE) { - return; + RETURN_THROWS(); } ZVAL_COPY_VALUE(¶ms[0], argument_ptr); ZVAL_NULL(¶ms[1]); } else { if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz|b", &argument_ptr, &argument2_ptr, &return_output) == FAILURE) { - return; + RETURN_THROWS(); } ZVAL_COPY_VALUE(¶ms[0], argument_ptr); ZVAL_COPY_VALUE(¶ms[1], argument2_ptr); @@ -1325,7 +1329,7 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c /* Create object */ if (object_init_ex(&reflector, ce_ptr) == FAILURE) { _DO_THROW("Could not create reflector"); - return; + RETURN_THROWS(); } /* Call __construct() */ @@ -1353,7 +1357,7 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c if (result == FAILURE) { zval_ptr_dtor(&reflector); _DO_THROW("Could not create reflector"); - return; + RETURN_THROWS(); } reflection_export_impl(return_value, &reflector, return_output); @@ -1439,7 +1443,7 @@ ZEND_METHOD(reflection, getModifierNames) zend_long modifiers; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &modifiers) == FAILURE) { - return; + RETURN_THROWS(); } array_init(return_value); @@ -1497,8 +1501,8 @@ ZEND_METHOD(reflection_function, __construct) } else { ALLOCA_FLAG(use_heap) - if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "S", &fname) == FAILURE) { - return; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &fname) == FAILURE) { + RETURN_THROWS(); } if (UNEXPECTED(ZSTR_VAL(fname)[0] == '\\')) { @@ -1516,7 +1520,7 @@ ZEND_METHOD(reflection_function, __construct) if (fptr == NULL) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Function %s() does not exist", ZSTR_VAL(fname)); - return; + RETURN_THROWS(); } } @@ -1541,7 +1545,7 @@ ZEND_METHOD(reflection_function, __toString) smart_str str = {0}; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(fptr); _function_string(&str, fptr, intern->ce, ""); @@ -1554,7 +1558,7 @@ ZEND_METHOD(reflection_function, __toString) ZEND_METHOD(reflection_function, getName) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } _default_get_name(ZEND_THIS, return_value); } @@ -1568,7 +1572,7 @@ ZEND_METHOD(reflection_function, isClosure) zend_function *fptr; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(fptr); RETURN_BOOL(fptr->common.fn_flags & ZEND_ACC_CLOSURE); @@ -1583,7 +1587,7 @@ ZEND_METHOD(reflection_function, getClosureThis) zval* closure_this; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT(); if (!Z_ISUNDEF(intern->obj)) { @@ -1604,7 +1608,7 @@ ZEND_METHOD(reflection_function, getClosureScopeClass) const zend_function *closure_func; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT(); if (!Z_ISUNDEF(intern->obj)) { @@ -1624,7 +1628,7 @@ ZEND_METHOD(reflection_function, getClosure) zend_function *fptr; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(fptr); @@ -1646,7 +1650,7 @@ ZEND_METHOD(reflection_function, isInternal) zend_function *fptr; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(fptr); RETURN_BOOL(fptr->type == ZEND_INTERNAL_FUNCTION); @@ -1661,7 +1665,7 @@ ZEND_METHOD(reflection_function, isUserDefined) zend_function *fptr; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(fptr); RETURN_BOOL(fptr->type == ZEND_USER_FUNCTION); @@ -1676,6 +1680,11 @@ ZEND_METHOD(reflection_function, isDisabled) zend_function *fptr; GET_REFLECTION_OBJECT_PTR(fptr); + + if (zend_parse_parameters_none() == FAILURE) { + RETURN_THROWS(); + } + RETURN_BOOL(fptr->type == ZEND_INTERNAL_FUNCTION && fptr->internal_function.handler == zif_display_disabled_function); } /* }}} */ @@ -1688,7 +1697,7 @@ ZEND_METHOD(reflection_function, getFileName) zend_function *fptr; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(fptr); if (fptr->type == ZEND_USER_FUNCTION) { @@ -1706,7 +1715,7 @@ ZEND_METHOD(reflection_function, getStartLine) zend_function *fptr; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(fptr); if (fptr->type == ZEND_USER_FUNCTION) { @@ -1724,7 +1733,7 @@ ZEND_METHOD(reflection_function, getEndLine) zend_function *fptr; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(fptr); if (fptr->type == ZEND_USER_FUNCTION) { @@ -1742,7 +1751,7 @@ ZEND_METHOD(reflection_function, getDocComment) zend_function *fptr; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(fptr); if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) { @@ -1761,7 +1770,7 @@ ZEND_METHOD(reflection_function, getStaticVariables) zval *val; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(fptr); @@ -1803,7 +1812,7 @@ ZEND_METHOD(reflection_function, invoke) GET_REFLECTION_OBJECT_PTR(fptr); if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", ¶ms, &num_args) == FAILURE) { - return; + RETURN_THROWS(); } fci.size = sizeof(fci); @@ -1820,7 +1829,7 @@ ZEND_METHOD(reflection_function, invoke) if (!Z_ISUNDEF(intern->obj)) { Z_OBJ_HT(intern->obj)->get_closure( - &intern->obj, &fcc.called_scope, &fcc.function_handler, &fcc.object); + Z_OBJ(intern->obj), &fcc.called_scope, &fcc.function_handler, &fcc.object, 0); } result = zend_call_function(&fci, &fcc); @@ -1828,7 +1837,7 @@ ZEND_METHOD(reflection_function, invoke) if (result == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Invocation of function %s() failed", ZSTR_VAL(fptr->common.function_name)); - return; + RETURN_THROWS(); } if (Z_TYPE(retval) != IS_UNDEF) { @@ -1857,7 +1866,7 @@ ZEND_METHOD(reflection_function, invokeArgs) GET_REFLECTION_OBJECT_PTR(fptr); if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", ¶m_array) == FAILURE) { - return; + RETURN_THROWS(); } argc = zend_hash_num_elements(Z_ARRVAL_P(param_array)); @@ -1883,7 +1892,7 @@ ZEND_METHOD(reflection_function, invokeArgs) if (!Z_ISUNDEF(intern->obj)) { Z_OBJ_HT(intern->obj)->get_closure( - &intern->obj, &fcc.called_scope, &fcc.function_handler, &fcc.object); + Z_OBJ(intern->obj), &fcc.called_scope, &fcc.function_handler, &fcc.object, 0); } result = zend_call_function(&fci, &fcc); @@ -1896,7 +1905,7 @@ ZEND_METHOD(reflection_function, invokeArgs) if (result == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Invocation of function %s() failed", ZSTR_VAL(fptr->common.function_name)); - return; + RETURN_THROWS(); } if (Z_TYPE(retval) != IS_UNDEF) { @@ -1917,6 +1926,10 @@ ZEND_METHOD(reflection_function, returnsReference) GET_REFLECTION_OBJECT_PTR(fptr); + if (zend_parse_parameters_none() == FAILURE) { + RETURN_THROWS(); + } + RETURN_BOOL((fptr->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0); } /* }}} */ @@ -1931,6 +1944,10 @@ ZEND_METHOD(reflection_function, getNumberOfParameters) GET_REFLECTION_OBJECT_PTR(fptr); + if (zend_parse_parameters_none() == FAILURE) { + RETURN_THROWS(); + } + num_args = fptr->common.num_args; if (fptr->common.fn_flags & ZEND_ACC_VARIADIC) { num_args++; @@ -1949,6 +1966,10 @@ ZEND_METHOD(reflection_function, getNumberOfRequiredParameters) GET_REFLECTION_OBJECT_PTR(fptr); + if (zend_parse_parameters_none() == FAILURE) { + RETURN_THROWS(); + } + RETURN_LONG(fptr->common.required_num_args); } /* }}} */ @@ -1964,6 +1985,10 @@ ZEND_METHOD(reflection_function, getParameters) GET_REFLECTION_OBJECT_PTR(fptr); + if (zend_parse_parameters_none() == FAILURE) { + RETURN_THROWS(); + } + arg_info= fptr->common.arg_info; num_args = fptr->common.num_args; if (fptr->common.fn_flags & ZEND_ACC_VARIADIC) { @@ -2003,6 +2028,10 @@ ZEND_METHOD(reflection_function, getExtension) GET_REFLECTION_OBJECT_PTR(fptr); + if (zend_parse_parameters_none() == FAILURE) { + RETURN_THROWS(); + } + if (fptr->type != ZEND_INTERNAL_FUNCTION) { RETURN_NULL(); } @@ -2026,6 +2055,10 @@ ZEND_METHOD(reflection_function, getExtensionName) GET_REFLECTION_OBJECT_PTR(fptr); + if (zend_parse_parameters_none() == FAILURE) { + RETURN_THROWS(); + } + if (fptr->type != ZEND_INTERNAL_FUNCTION) { RETURN_FALSE; } @@ -2049,14 +2082,14 @@ ZEND_METHOD(reflection_generator, __construct) object = ZEND_THIS; intern = Z_REFLECTION_P(object); - if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "O", &generator, zend_ce_generator) == FAILURE) { - return; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &generator, zend_ce_generator) == FAILURE) { + RETURN_THROWS(); } ex = ((zend_generator *) Z_OBJ_P(generator))->execute_data; if (!ex) { _DO_THROW("Cannot create ReflectionGenerator based on a terminated Generator"); - return; + RETURN_THROWS(); } intern->ref_type = REF_TYPE_GENERATOR; @@ -2069,7 +2102,7 @@ ZEND_METHOD(reflection_generator, __construct) #define REFLECTION_CHECK_VALID_GENERATOR(ex) \ if (!ex) { \ _DO_THROW("Cannot fetch information from a terminated Generator"); \ - return; \ + RETURN_THROWS(); \ } /* {{{ proto public array ReflectionGenerator::getTrace($options = DEBUG_BACKTRACE_PROVIDE_OBJECT) */ @@ -2083,7 +2116,7 @@ ZEND_METHOD(reflection_generator, getTrace) zend_execute_data *root_prev = NULL, *cur_prev; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &options) == FAILURE) { - return; + RETURN_THROWS(); } REFLECTION_CHECK_VALID_GENERATOR(ex) @@ -2115,7 +2148,7 @@ ZEND_METHOD(reflection_generator, getExecutingLine) zend_execute_data *ex = generator->execute_data; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } REFLECTION_CHECK_VALID_GENERATOR(ex) @@ -2131,7 +2164,7 @@ ZEND_METHOD(reflection_generator, getExecutingFile) zend_execute_data *ex = generator->execute_data; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } REFLECTION_CHECK_VALID_GENERATOR(ex) @@ -2147,7 +2180,7 @@ ZEND_METHOD(reflection_generator, getFunction) zend_execute_data *ex = generator->execute_data; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } REFLECTION_CHECK_VALID_GENERATOR(ex) @@ -2171,7 +2204,7 @@ ZEND_METHOD(reflection_generator, getThis) zend_execute_data *ex = generator->execute_data; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } REFLECTION_CHECK_VALID_GENERATOR(ex) @@ -2193,7 +2226,7 @@ ZEND_METHOD(reflection_generator, getExecutingGenerator) zend_generator *current; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } REFLECTION_CHECK_VALID_GENERATOR(ex) @@ -2229,8 +2262,8 @@ ZEND_METHOD(reflection_parameter, __construct) zend_class_entry *ce = NULL; zend_bool is_closure = 0; - if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "zz", &reference, ¶meter) == FAILURE) { - return; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &reference, ¶meter) == FAILURE) { + RETURN_THROWS(); } object = ZEND_THIS; @@ -2246,7 +2279,7 @@ ZEND_METHOD(reflection_parameter, __construct) if (!fptr) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Function %s() does not exist", Z_STRVAL_P(reference)); - return; + RETURN_THROWS(); } ce = fptr->common.scope; } @@ -2261,7 +2294,7 @@ ZEND_METHOD(reflection_parameter, __construct) || ((method = zend_hash_index_find(Z_ARRVAL_P(reference), 1)) == NULL)) { _DO_THROW("Expected array($object, $method) or array($classname, $method)"); - return; + RETURN_THROWS(); } if (Z_TYPE_P(classref) == IS_OBJECT) { @@ -2275,7 +2308,7 @@ ZEND_METHOD(reflection_parameter, __construct) zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s does not exist", ZSTR_VAL(name)); zend_string_release(name); - return; + RETURN_THROWS(); } zend_string_release(name); } @@ -2296,7 +2329,7 @@ ZEND_METHOD(reflection_parameter, __construct) zend_string_release(lcname); zend_throw_exception_ex(reflection_exception_ptr, 0, "Method %s::%s() does not exist", ZSTR_VAL(ce->name), Z_STRVAL_P(method)); - return; + RETURN_THROWS(); } zend_string_release(name); zend_string_release(lcname); @@ -2313,14 +2346,14 @@ ZEND_METHOD(reflection_parameter, __construct) } else if ((fptr = zend_hash_find_ptr(&ce->function_table, ZSTR_KNOWN(ZEND_STR_MAGIC_INVOKE))) == NULL) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Method %s::%s() does not exist", ZSTR_VAL(ce->name), ZEND_INVOKE_FUNC_NAME); - return; + RETURN_THROWS(); } } break; default: _DO_THROW("The parameter class is expected to be either a string, an array(class, method) or a callable object"); - return; + RETURN_THROWS(); } /* Now, search for the parameter */ @@ -2398,9 +2431,7 @@ ZEND_METHOD(reflection_parameter, __construct) failure: if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) { - if (fptr->type != ZEND_OVERLOADED_FUNCTION) { - zend_string_release_ex(fptr->common.function_name, 0); - } + zend_string_release_ex(fptr->common.function_name, 0); zend_free_trampoline(fptr); } if (is_closure) { @@ -2418,7 +2449,7 @@ ZEND_METHOD(reflection_parameter, __toString) smart_str str = {0}; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(param); _parameter_string(&str, param->fptr, param->arg_info, param->offset, param->required, ""); @@ -2432,7 +2463,7 @@ ZEND_METHOD(reflection_parameter, __toString) ZEND_METHOD(reflection_parameter, getName) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } _default_get_name(ZEND_THIS, return_value); } @@ -2446,7 +2477,7 @@ ZEND_METHOD(reflection_parameter, getDeclaringFunction) parameter_reference *param; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(param); @@ -2466,7 +2497,7 @@ ZEND_METHOD(reflection_parameter, getDeclaringClass) parameter_reference *param; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(param); @@ -2485,11 +2516,12 @@ ZEND_METHOD(reflection_parameter, getClass) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(param); - if (ZEND_TYPE_IS_CLASS(param->arg_info->type)) { + // TODO: This is going to return null for union types, which is rather odd. + if (ZEND_TYPE_HAS_NAME(param->arg_info->type)) { /* Class name is stored as a string, we might also get "self" or "parent" * - For "self", simply use the function scope. If scope is NULL then * the function is global and thus self does not make any sense @@ -2510,19 +2542,19 @@ ZEND_METHOD(reflection_parameter, getClass) if (!ce) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Parameter uses 'self' as type hint but function is not a class member!"); - return; + RETURN_THROWS(); } } else if (0 == zend_binary_strcasecmp(ZSTR_VAL(class_name), ZSTR_LEN(class_name), "parent", sizeof("parent")- 1)) { ce = param->fptr->common.scope; if (!ce) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Parameter uses 'parent' as type hint but function is not a class member!"); - return; + RETURN_THROWS(); } if (!ce->parent) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Parameter uses 'parent' as type hint although class does not have a parent!"); - return; + RETURN_THROWS(); } ce = ce->parent; } else { @@ -2530,7 +2562,7 @@ ZEND_METHOD(reflection_parameter, getClass) if (!ce) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s does not exist", ZSTR_VAL(class_name)); - return; + RETURN_THROWS(); } } zend_reflection_class_factory(ce, return_value); @@ -2546,7 +2578,7 @@ ZEND_METHOD(reflection_parameter, hasType) parameter_reference *param; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(param); @@ -2562,14 +2594,14 @@ ZEND_METHOD(reflection_parameter, getType) parameter_reference *param; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(param); if (!ZEND_TYPE_IS_SET(param->arg_info->type)) { RETURN_NULL(); } - reflection_type_factory(param->arg_info->type, return_value); + reflection_type_factory(param->arg_info->type, return_value, 1); } /* }}} */ @@ -2579,13 +2611,15 @@ ZEND_METHOD(reflection_parameter, isArray) { reflection_object *intern; parameter_reference *param; + uint32_t type_mask; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(param); - RETVAL_BOOL(ZEND_TYPE_CODE(param->arg_info->type) == IS_ARRAY); + type_mask = ZEND_TYPE_PURE_MASK_WITHOUT_NULL(param->arg_info->type); + RETVAL_BOOL(type_mask == MAY_BE_ARRAY); } /* }}} */ @@ -2595,13 +2629,15 @@ ZEND_METHOD(reflection_parameter, isCallable) { reflection_object *intern; parameter_reference *param; + uint32_t type_mask; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(param); - RETVAL_BOOL(ZEND_TYPE_CODE(param->arg_info->type) == IS_CALLABLE); + type_mask = ZEND_TYPE_PURE_MASK_WITHOUT_NULL(param->arg_info->type); + RETVAL_BOOL(type_mask == MAY_BE_CALLABLE); } /* }}} */ @@ -2613,11 +2649,12 @@ ZEND_METHOD(reflection_parameter, allowsNull) parameter_reference *param; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(param); - RETVAL_BOOL(ZEND_TYPE_ALLOW_NULL(param->arg_info->type)); + RETVAL_BOOL(!ZEND_TYPE_IS_SET(param->arg_info->type) + || ZEND_TYPE_ALLOW_NULL(param->arg_info->type)); } /* }}} */ @@ -2629,11 +2666,11 @@ ZEND_METHOD(reflection_parameter, isPassedByReference) parameter_reference *param; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(param); - RETVAL_BOOL(param->arg_info->pass_by_reference); + RETVAL_BOOL(ZEND_ARG_SEND_MODE(param->arg_info)); } /* }}} */ @@ -2645,12 +2682,12 @@ ZEND_METHOD(reflection_parameter, canBePassedByValue) parameter_reference *param; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(param); /* true if it's ZEND_SEND_BY_VAL or ZEND_SEND_PREFER_REF */ - RETVAL_BOOL(param->arg_info->pass_by_reference != ZEND_SEND_BY_REF); + RETVAL_BOOL(ZEND_ARG_SEND_MODE(param->arg_info) != ZEND_SEND_BY_REF); } /* }}} */ @@ -2662,7 +2699,7 @@ ZEND_METHOD(reflection_parameter, getPosition) parameter_reference *param; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(param); @@ -2678,7 +2715,7 @@ ZEND_METHOD(reflection_parameter, isOptional) parameter_reference *param; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(param); @@ -2695,7 +2732,7 @@ ZEND_METHOD(reflection_parameter, isDefaultValueAvailable) zend_op *precv; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(param); @@ -2720,7 +2757,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValue) zend_op *precv; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } param = _reflection_param_get_default_param(INTERNAL_FUNCTION_PARAM_PASSTHRU); @@ -2748,7 +2785,7 @@ ZEND_METHOD(reflection_parameter, isDefaultValueConstant) parameter_reference *param; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } param = _reflection_param_get_default_param(INTERNAL_FUNCTION_PARAM_PASSTHRU); @@ -2778,7 +2815,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValueConstantName) parameter_reference *param; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } param = _reflection_param_get_default_param(INTERNAL_FUNCTION_PARAM_PASSTHRU); @@ -2807,11 +2844,11 @@ ZEND_METHOD(reflection_parameter, isVariadic) parameter_reference *param; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(param); - RETVAL_BOOL(param->arg_info->is_variadic); + RETVAL_BOOL(ZEND_ARG_IS_VARIADIC(param->arg_info)); } /* }}} */ @@ -2823,7 +2860,7 @@ ZEND_METHOD(reflection_type, allowsNull) type_reference *param; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(param); @@ -2831,64 +2868,136 @@ ZEND_METHOD(reflection_type, allowsNull) } /* }}} */ -/* {{{ proto public bool ReflectionType::isBuiltin() - Returns whether parameter is a builtin type */ -ZEND_METHOD(reflection_type, isBuiltin) +static zend_string *zend_type_to_string_without_null(zend_type type) { + ZEND_TYPE_FULL_MASK(type) &= ~MAY_BE_NULL; + return zend_type_to_string(type); +} + +/* {{{ proto public string ReflectionType::__toString() + Return the text of the type hint */ +ZEND_METHOD(reflection_type, __toString) { reflection_object *intern; type_reference *param; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(param); - RETVAL_BOOL(ZEND_TYPE_IS_CODE(param->type)); + RETURN_STR(zend_type_to_string(param->type)); } /* }}} */ -/* {{{ reflection_type_name */ -static zend_string *reflection_type_name(type_reference *param) { - if (ZEND_TYPE_IS_NAME(param->type)) { - return zend_string_copy(ZEND_TYPE_NAME(param->type)); - } else if (ZEND_TYPE_IS_CE(param->type)) { - return zend_string_copy(ZEND_TYPE_CE(param->type)->name); - } else { - char *name = zend_get_type_by_const(ZEND_TYPE_CODE(param->type)); - return zend_string_init(name, strlen(name), 0); +/* {{{ proto public string ReflectionNamedType::getName() + Return the name of the type */ +ZEND_METHOD(reflection_named_type, getName) +{ + reflection_object *intern; + type_reference *param; + + if (zend_parse_parameters_none() == FAILURE) { + RETURN_THROWS(); } + GET_REFLECTION_OBJECT_PTR(param); + + if (param->legacy_behavior) { + RETURN_STR(zend_type_to_string_without_null(param->type)); + } + RETURN_STR(zend_type_to_string(param->type)); } /* }}} */ -/* {{{ proto public string ReflectionType::__toString() - Return the text of the type hint */ -ZEND_METHOD(reflection_type, __toString) +/* {{{ proto public bool ReflectionNamedType::isBuiltin() + Returns whether type is a builtin type */ +ZEND_METHOD(reflection_named_type, isBuiltin) { reflection_object *intern; type_reference *param; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(param); - RETURN_STR(reflection_type_name(param)); + RETVAL_BOOL(ZEND_TYPE_IS_ONLY_MASK(param->type)); } /* }}} */ -/* {{{ proto public string ReflectionNamedType::getName() - Return the text of the type hint */ -ZEND_METHOD(reflection_named_type, getName) +static void append_type(zval *return_value, zend_type type) { + zval reflection_type; + reflection_type_factory(type, &reflection_type, 0); + zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &reflection_type); +} + +static void append_type_mask(zval *return_value, uint32_t type_mask) { + append_type(return_value, (zend_type) ZEND_TYPE_INIT_MASK(type_mask)); +} + +/* {{{ proto public string ReflectionUnionType::getTypes() + Returns the types that are part of this union type */ +ZEND_METHOD(reflection_union_type, getTypes) { reflection_object *intern; type_reference *param; + uint32_t type_mask; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(param); - RETURN_STR(reflection_type_name(param)); + array_init(return_value); + if (ZEND_TYPE_HAS_LIST(param->type)) { + void *entry; + ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(param->type), entry) { + if (ZEND_TYPE_LIST_IS_NAME(entry)) { + append_type(return_value, + (zend_type) ZEND_TYPE_INIT_CLASS(ZEND_TYPE_LIST_GET_NAME(entry), 0, 0)); + } else { + append_type(return_value, + (zend_type) ZEND_TYPE_INIT_CE(ZEND_TYPE_LIST_GET_CE(entry), 0, 0)); + } + } ZEND_TYPE_LIST_FOREACH_END(); + } else if (ZEND_TYPE_HAS_NAME(param->type)) { + append_type(return_value, + (zend_type) ZEND_TYPE_INIT_CLASS(ZEND_TYPE_NAME(param->type), 0, 0)); + } else if (ZEND_TYPE_HAS_CE(param->type)) { + append_type(return_value, + (zend_type) ZEND_TYPE_INIT_CE(ZEND_TYPE_CE(param->type), 0, 0)); + } + + type_mask = ZEND_TYPE_PURE_MASK(param->type); + ZEND_ASSERT(!(type_mask & MAY_BE_VOID)); + if (type_mask & MAY_BE_CALLABLE) { + append_type_mask(return_value, MAY_BE_CALLABLE); + } + if (type_mask & MAY_BE_ITERABLE) { + append_type_mask(return_value, MAY_BE_ITERABLE); + } + if (type_mask & MAY_BE_OBJECT) { + append_type_mask(return_value, MAY_BE_OBJECT); + } + if (type_mask & MAY_BE_ARRAY) { + append_type_mask(return_value, MAY_BE_ARRAY); + } + if (type_mask & MAY_BE_STRING) { + append_type_mask(return_value, MAY_BE_STRING); + } + if (type_mask & MAY_BE_LONG) { + append_type_mask(return_value, MAY_BE_LONG); + } + if (type_mask & MAY_BE_DOUBLE) { + append_type_mask(return_value, MAY_BE_DOUBLE); + } + if ((type_mask & MAY_BE_BOOL) == MAY_BE_BOOL) { + append_type_mask(return_value, MAY_BE_BOOL); + } else if (type_mask & MAY_BE_FALSE) { + append_type_mask(return_value, MAY_BE_FALSE); + } + if (type_mask & MAY_BE_NULL) { + append_type_mask(return_value, MAY_BE_NULL); + } } /* }}} */ @@ -2915,14 +3024,14 @@ ZEND_METHOD(reflection_method, __construct) zval ztmp; if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "zs", &classname, &name_str, &name_len) == FAILURE) { - if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s", &name_str, &name_len) == FAILURE) { - return; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name_str, &name_len) == FAILURE) { + RETURN_THROWS(); } if ((tmp = strstr(name_str, "::")) == NULL) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Invalid method name %s", name_str); - return; + RETURN_THROWS(); } classname = &ztmp; tmp_len = tmp - name_str; @@ -2950,7 +3059,7 @@ ZEND_METHOD(reflection_method, __construct) if (classname == &ztmp) { zval_ptr_dtor_str(&ztmp); } - return; + RETURN_THROWS(); } break; @@ -2963,7 +3072,7 @@ ZEND_METHOD(reflection_method, __construct) zval_ptr_dtor_str(&ztmp); } _DO_THROW("The parameter class is expected to be either a string or an object"); - return; + RETURN_THROWS(); } if (classname == &ztmp) { @@ -2981,7 +3090,7 @@ ZEND_METHOD(reflection_method, __construct) efree(lcname); zend_throw_exception_ex(reflection_exception_ptr, 0, "Method %s::%s() does not exist", ZSTR_VAL(ce->name), name_str); - return; + RETURN_THROWS(); } efree(lcname); @@ -3002,7 +3111,7 @@ ZEND_METHOD(reflection_method, __toString) smart_str str = {0}; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(mptr); _function_string(&str, mptr, intern->ce, ""); @@ -3024,12 +3133,12 @@ ZEND_METHOD(reflection_method, getClosure) zend_create_fake_closure(return_value, mptr, mptr->common.scope, mptr->common.scope, NULL); } else { if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &obj) == FAILURE) { - return; + RETURN_THROWS(); } if (!instanceof_function(Z_OBJCE_P(obj), mptr->common.scope)) { _DO_THROW("Given object is not an instance of the class this method was declared in"); - return; + RETURN_THROWS(); } /* This is an original closure object and __invoke is to be called. */ @@ -3064,7 +3173,7 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic) zend_throw_exception_ex(reflection_exception_ptr, 0, "Trying to invoke abstract method %s::%s()", ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name)); - return; + RETURN_THROWS(); } if (!(mptr->common.fn_flags & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) { @@ -3073,16 +3182,16 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic) mptr->common.fn_flags & ZEND_ACC_PROTECTED ? "protected" : "private", ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name), ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name)); - return; + RETURN_THROWS(); } if (variadic) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "o!*", &object, ¶ms, &argc) == FAILURE) { - return; + RETURN_THROWS(); } } else { if (zend_parse_parameters(ZEND_NUM_ARGS(), "o!a", &object, ¶m_array) == FAILURE) { - return; + RETURN_THROWS(); } argc = zend_hash_num_elements(Z_ARRVAL_P(param_array)); @@ -3109,7 +3218,7 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic) zend_throw_exception_ex(reflection_exception_ptr, 0, "Trying to invoke non static method %s::%s() without an object", ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name)); - return; + RETURN_THROWS(); } obj_ce = Z_OBJCE_P(object); @@ -3119,7 +3228,7 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic) efree(params); } _DO_THROW("Given object is not an instance of the class this method was declared in"); - return; + RETURN_THROWS(); } } @@ -3154,7 +3263,7 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic) if (result == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Invocation of method %s::%s() failed", ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name)); - return; + RETURN_THROWS(); } if (Z_TYPE(retval) != IS_UNDEF) { @@ -3166,7 +3275,7 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic) } /* }}} */ -/* {{{ proto public mixed ReflectionMethod::invoke(mixed object, mixed* args) +/* {{{ proto public mixed ReflectionMethod::invoke(mixed object, [mixed* args]) Invokes the method. */ ZEND_METHOD(reflection_method, invoke) { @@ -3262,7 +3371,7 @@ ZEND_METHOD(reflection_function, inNamespace) const char *backslash; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if ((name = _default_load_name(ZEND_THIS)) == NULL) { RETURN_FALSE; @@ -3285,7 +3394,7 @@ ZEND_METHOD(reflection_function, getNamespaceName) const char *backslash; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if ((name = _default_load_name(ZEND_THIS)) == NULL) { RETURN_FALSE; @@ -3308,7 +3417,7 @@ ZEND_METHOD(reflection_function, getShortName) const char *backslash; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if ((name = _default_load_name(ZEND_THIS)) == NULL) { RETURN_FALSE; @@ -3331,7 +3440,7 @@ ZEND_METHOD(reflection_function, hasReturnType) zend_function *fptr; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(fptr); @@ -3348,7 +3457,7 @@ ZEND_METHOD(reflection_function, getReturnType) zend_function *fptr; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(fptr); @@ -3357,7 +3466,7 @@ ZEND_METHOD(reflection_function, getReturnType) RETURN_NULL(); } - reflection_type_factory(fptr->common.arg_info[-1].type, return_value); + reflection_type_factory(fptr->common.arg_info[-1].type, return_value, 1); } /* }}} */ @@ -3369,7 +3478,7 @@ ZEND_METHOD(reflection_method, isConstructor) zend_function *mptr; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(mptr); /* we need to check if the ctor is the ctor of the class level we we @@ -3387,7 +3496,7 @@ ZEND_METHOD(reflection_method, isDestructor) zend_function *mptr; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(mptr); RETURN_BOOL(mptr->common.fn_flags & ZEND_ACC_DTOR); @@ -3404,7 +3513,7 @@ ZEND_METHOD(reflection_method, getModifiers) | ZEND_ACC_STATIC | ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(mptr); @@ -3422,7 +3531,7 @@ ZEND_METHOD(reflection_method, getDeclaringClass) GET_REFLECTION_OBJECT_PTR(mptr); if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } zend_reflection_class_factory(mptr->common.scope, return_value); @@ -3439,13 +3548,13 @@ ZEND_METHOD(reflection_method, getPrototype) GET_REFLECTION_OBJECT_PTR(mptr); if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if (!mptr->common.prototype) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Method %s::%s does not have a prototype", ZSTR_VAL(intern->ce->name), ZSTR_VAL(mptr->common.function_name)); - return; + RETURN_THROWS(); } reflection_method_factory(mptr->common.prototype->common.scope, mptr->common.prototype, NULL, return_value); @@ -3460,7 +3569,7 @@ ZEND_METHOD(reflection_method, setAccessible) zend_bool visible; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &visible) == FAILURE) { - return; + RETURN_THROWS(); } intern = Z_REFLECTION_P(ZEND_THIS); @@ -3479,8 +3588,8 @@ ZEND_METHOD(reflection_class_constant, __construct) zend_class_entry *ce; zend_class_constant *constant = NULL; - if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "zS", &classname, &constname) == FAILURE) { - return; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zS", &classname, &constname) == FAILURE) { + RETURN_THROWS(); } object = ZEND_THIS; @@ -3492,7 +3601,7 @@ ZEND_METHOD(reflection_class_constant, __construct) if ((ce = zend_lookup_class(Z_STR_P(classname))) == NULL) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s does not exist", Z_STRVAL_P(classname)); - return; + RETURN_THROWS(); } break; @@ -3502,12 +3611,12 @@ ZEND_METHOD(reflection_class_constant, __construct) default: _DO_THROW("The parameter class is expected to be either a string or an object"); - return; + RETURN_THROWS(); } if ((constant = zend_hash_find_ptr(&ce->constants_table, constname)) == NULL) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Class Constant %s::%s does not exist", ZSTR_VAL(ce->name), ZSTR_VAL(constname)); - return; + RETURN_THROWS(); } intern->ptr = constant; @@ -3529,7 +3638,7 @@ ZEND_METHOD(reflection_class_constant, __toString) zval name; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ref); _default_get_name(ZEND_THIS, &name); @@ -3544,7 +3653,7 @@ ZEND_METHOD(reflection_class_constant, __toString) ZEND_METHOD(reflection_class_constant, getName) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } _default_get_name(ZEND_THIS, return_value); } @@ -3556,7 +3665,7 @@ static void _class_constant_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask) / zend_class_constant *ref; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ref); RETURN_BOOL(Z_ACCESS_FLAGS(ref->value) & mask); @@ -3595,7 +3704,7 @@ ZEND_METHOD(reflection_class_constant, getModifiers) zend_class_constant *ref; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ref); @@ -3611,7 +3720,7 @@ ZEND_METHOD(reflection_class_constant, getValue) zend_class_constant *ref; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ref); @@ -3630,7 +3739,7 @@ ZEND_METHOD(reflection_class_constant, getDeclaringClass) zend_class_constant *ref; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ref); @@ -3646,7 +3755,7 @@ ZEND_METHOD(reflection_class_constant, getDocComment) zend_class_constant *ref; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ref); if (ref->doc_comment) { @@ -3693,14 +3802,14 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob } } else { if (!try_convert_to_string(argument)) { - return; + RETURN_THROWS(); } if ((ce = zend_lookup_class(Z_STR_P(argument))) == NULL) { if (!EG(exception)) { zend_throw_exception_ex(reflection_exception_ptr, -1, "Class %s does not exist", Z_STRVAL_P(argument)); } - return; + RETURN_THROWS(); } ZVAL_STR_COPY(reflection_prop_name(object), ce->name); @@ -3739,7 +3848,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value } else if (!statics && (prop_info->flags & ZEND_ACC_STATIC) == 0) { prop = &ce->default_properties_table[OBJ_PROP_TO_NUM(prop_info->offset)]; } - if (!prop || (prop_info->type && Z_ISUNDEF_P(prop))) { + if (!prop || (ZEND_TYPE_IS_SET(prop_info->type) && Z_ISUNDEF_P(prop))) { continue; } @@ -3768,7 +3877,7 @@ ZEND_METHOD(reflection_class, getStaticProperties) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); @@ -3792,7 +3901,7 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue) zval *prop, *def_value = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|z", &name, &def_value) == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); @@ -3826,7 +3935,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue) zval *variable_ptr, *value; if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz", &name, &value) == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); @@ -3839,7 +3948,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue) zend_clear_exception(); zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s does not have a property named %s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); - return; + RETURN_THROWS(); } if (Z_ISREF_P(variable_ptr)) { @@ -3851,7 +3960,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue) } } - if (prop_info->type && !zend_verify_property_type(prop_info, value, 0)) { + if (ZEND_TYPE_IS_SET(prop_info->type) && !zend_verify_property_type(prop_info, value, 0)) { return; } @@ -3869,7 +3978,7 @@ ZEND_METHOD(reflection_class, getDefaultProperties) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); array_init(return_value); @@ -3890,7 +3999,7 @@ ZEND_METHOD(reflection_class, __toString) smart_str str = {0}; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); _class_string(&str, ce, &intern->obj, ""); @@ -3903,7 +4012,7 @@ ZEND_METHOD(reflection_class, __toString) ZEND_METHOD(reflection_class, getName) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } _default_get_name(ZEND_THIS, return_value); } @@ -3917,7 +4026,7 @@ ZEND_METHOD(reflection_class, isInternal) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); RETURN_BOOL(ce->type == ZEND_INTERNAL_CLASS); @@ -3932,7 +4041,7 @@ ZEND_METHOD(reflection_class, isUserDefined) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); RETURN_BOOL(ce->type == ZEND_USER_CLASS); @@ -3947,7 +4056,7 @@ ZEND_METHOD(reflection_class, isAnonymous) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); RETURN_BOOL(ce->ce_flags & ZEND_ACC_ANON_CLASS); @@ -3962,7 +4071,7 @@ ZEND_METHOD(reflection_class, getFileName) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); if (ce->type == ZEND_USER_CLASS) { @@ -3980,7 +4089,7 @@ ZEND_METHOD(reflection_class, getStartLine) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); if (ce->type == ZEND_USER_CLASS) { @@ -3998,7 +4107,7 @@ ZEND_METHOD(reflection_class, getEndLine) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); if (ce->type == ZEND_USER_CLASS) { @@ -4016,7 +4125,7 @@ ZEND_METHOD(reflection_class, getDocComment) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); if (ce->type == ZEND_USER_CLASS && ce->info.user.doc_comment) { @@ -4034,7 +4143,7 @@ ZEND_METHOD(reflection_class, getConstructor) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); @@ -4055,7 +4164,7 @@ ZEND_METHOD(reflection_class, hasMethod) zend_string *name, *lc_name; if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); @@ -4076,7 +4185,7 @@ ZEND_METHOD(reflection_class, getMethod) zend_string *name, *lc_name; if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); @@ -4125,7 +4234,7 @@ ZEND_METHOD(reflection_class, getMethods) zend_bool filter_is_null = 1; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &filter, &filter_is_null) == FAILURE) { - return; + RETURN_THROWS(); } if (filter_is_null) { @@ -4168,10 +4277,9 @@ ZEND_METHOD(reflection_class, hasProperty) zend_property_info *property_info; zend_class_entry *ce; zend_string *name; - zval property; if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); @@ -4182,12 +4290,9 @@ ZEND_METHOD(reflection_class, hasProperty) RETURN_TRUE; } else { if (Z_TYPE(intern->obj) != IS_UNDEF) { - ZVAL_STR_COPY(&property, name); - if (Z_OBJ_HANDLER(intern->obj, has_property)(&intern->obj, &property, 2, NULL)) { - zval_ptr_dtor(&property); + if (Z_OBJ_HANDLER(intern->obj, has_property)(Z_OBJ(intern->obj), name, 2, NULL)) { RETURN_TRUE; } - zval_ptr_dtor(&property); } RETURN_FALSE; } @@ -4206,25 +4311,19 @@ ZEND_METHOD(reflection_class, getProperty) size_t classname_len, str_name_len; if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); if ((property_info = zend_hash_find_ptr(&ce->properties_info, name)) != NULL) { if (!(property_info->flags & ZEND_ACC_PRIVATE) || property_info->ce == ce) { - reflection_property_factory(ce, name, property_info, return_value, 0); + reflection_property_factory(ce, name, property_info, return_value); return; } } else if (Z_TYPE(intern->obj) != IS_UNDEF) { /* Check for dynamic properties */ - if (zend_hash_exists(Z_OBJ_HT(intern->obj)->get_properties(&intern->obj), name)) { - zend_property_info property_info_tmp; - property_info_tmp.flags = ZEND_ACC_PUBLIC; - property_info_tmp.name = name; - property_info_tmp.doc_comment = NULL; - property_info_tmp.ce = ce; - - reflection_property_factory(ce, name, &property_info_tmp, return_value, 1); + if (zend_hash_exists(Z_OBJ_HT(intern->obj)->get_properties(Z_OBJ(intern->obj)), name)) { + reflection_property_factory(ce, name, NULL, return_value); return; } } @@ -4243,13 +4342,13 @@ ZEND_METHOD(reflection_class, getProperty) zend_throw_exception_ex(reflection_exception_ptr, -1, "Class %s does not exist", ZSTR_VAL(classname)); } zend_string_release_ex(classname, 0); - return; + RETURN_THROWS(); } zend_string_release_ex(classname, 0); if (!instanceof_function(ce, ce2)) { zend_throw_exception_ex(reflection_exception_ptr, -1, "Fully qualified property name %s::%s does not specify a base class of %s", ZSTR_VAL(ce2->name), str_name, ZSTR_VAL(ce->name)); - return; + RETURN_THROWS(); } ce = ce2; @@ -4275,7 +4374,7 @@ static void _addproperty(zend_property_info *pptr, zend_string *key, zend_class_ if (pptr->flags & filter) { zval property; - reflection_property_factory(ce, key, pptr, &property, 0); + reflection_property_factory(ce, key, pptr, &property); add_next_index_zval(retval, &property); } } @@ -4284,7 +4383,6 @@ static void _addproperty(zend_property_info *pptr, zend_string *key, zend_class_ /* {{{ _adddynproperty */ static void _adddynproperty(zval *ptr, zend_string *key, zend_class_entry *ce, zval *retval) { - zend_property_info property_info; zval property; /* under some circumstances, the properties hash table may contain numeric @@ -4299,12 +4397,7 @@ static void _adddynproperty(zval *ptr, zend_string *key, zend_class_entry *ce, z return; } - property_info.doc_comment = NULL; - property_info.flags = ZEND_ACC_PUBLIC; - property_info.name = key; - property_info.ce = ce; - property_info.offset = -1; - reflection_property_factory(ce, key, &property_info, &property, 1); + reflection_property_factory(ce, key, NULL, &property); add_next_index_zval(retval, &property); } /* }}} */ @@ -4321,9 +4414,9 @@ ZEND_METHOD(reflection_class, getProperties) zend_bool filter_is_null = 1; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &filter, &filter_is_null) == FAILURE) { - return; + RETURN_THROWS(); } - + if (filter_is_null) { filter = ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC; } @@ -4336,7 +4429,7 @@ ZEND_METHOD(reflection_class, getProperties) } ZEND_HASH_FOREACH_END(); if (Z_TYPE(intern->obj) != IS_UNDEF && (filter & ZEND_ACC_PUBLIC) != 0) { - HashTable *properties = Z_OBJ_HT(intern->obj)->get_properties(&intern->obj); + HashTable *properties = Z_OBJ_HT(intern->obj)->get_properties(Z_OBJ(intern->obj)); zval *prop; ZEND_HASH_FOREACH_STR_KEY_VAL(properties, key, prop) { _adddynproperty(prop, key, ce, return_value); @@ -4354,7 +4447,7 @@ ZEND_METHOD(reflection_class, hasConstant) zend_string *name; if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); @@ -4377,7 +4470,7 @@ ZEND_METHOD(reflection_class, getConstants) zval val; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); array_init(return_value); @@ -4402,7 +4495,7 @@ ZEND_METHOD(reflection_class, getReflectionConstants) zend_class_constant *constant; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); array_init(return_value); @@ -4424,7 +4517,7 @@ ZEND_METHOD(reflection_class, getConstant) zend_string *name; if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); @@ -4451,7 +4544,7 @@ ZEND_METHOD(reflection_class, getReflectionConstant) GET_REFLECTION_OBJECT_PTR(ce); if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) { - return; + RETURN_THROWS(); } if ((constant = zend_hash_find_ptr(&ce->constants_table, name)) == NULL) { @@ -4468,7 +4561,7 @@ static void _class_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); RETVAL_BOOL(ce->ce_flags & mask); @@ -4483,7 +4576,7 @@ ZEND_METHOD(reflection_class, isInstantiable) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); if (ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS)) { @@ -4509,7 +4602,7 @@ ZEND_METHOD(reflection_class, isCloneable) zval obj; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); if (ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS)) { @@ -4577,7 +4670,7 @@ ZEND_METHOD(reflection_class, getModifiers) | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); @@ -4594,14 +4687,14 @@ ZEND_METHOD(reflection_class, isInstance) zval *object; if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &object) == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); RETURN_BOOL(instanceof_function(Z_OBJCE_P(object), ce)); } /* }}} */ -/* {{{ proto public object ReflectionClass::newInstance(mixed* args, ...) +/* {{{ proto public object ReflectionClass::newInstance([mixed* args], ...) Returns an instance of this class */ ZEND_METHOD(reflection_class, newInstance) { @@ -4636,7 +4729,7 @@ ZEND_METHOD(reflection_class, newInstance) if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", ¶ms, &num_args) == FAILURE) { zval_ptr_dtor(return_value); - RETURN_FALSE; + RETURN_THROWS(); } for (i = 0; i < num_args; i++) { @@ -4684,10 +4777,14 @@ ZEND_METHOD(reflection_class, newInstanceWithoutConstructor) GET_REFLECTION_OBJECT_PTR(ce); + if (zend_parse_parameters_none() == FAILURE) { + RETURN_THROWS(); + } + if (ce->type == ZEND_INTERNAL_CLASS && ce->create_object != NULL && (ce->ce_flags & ZEND_ACC_FINAL)) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s is an internal class marked as final that cannot be instantiated without invoking its constructor", ZSTR_VAL(ce->name)); - return; + RETURN_THROWS(); } object_init_ex(return_value, ce); @@ -4708,7 +4805,7 @@ ZEND_METHOD(reflection_class, newInstanceArgs) GET_REFLECTION_OBJECT_PTR(ce); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|h", &args) == FAILURE) { - return; + RETURN_THROWS(); } if (ZEND_NUM_ARGS() > 0) { @@ -4789,7 +4886,7 @@ ZEND_METHOD(reflection_class, getInterfaces) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); @@ -4818,7 +4915,7 @@ ZEND_METHOD(reflection_class, getInterfaceNames) uint32_t i; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); @@ -4845,7 +4942,7 @@ ZEND_METHOD(reflection_class, getTraits) uint32_t i; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); @@ -4877,7 +4974,7 @@ ZEND_METHOD(reflection_class, getTraitNames) uint32_t i; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); @@ -4901,7 +4998,7 @@ ZEND_METHOD(reflection_class, getTraitAliases) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); @@ -4936,7 +5033,7 @@ ZEND_METHOD(reflection_class, getParentClass) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); @@ -4959,7 +5056,7 @@ ZEND_METHOD(reflection_class, isSubclassOf) GET_REFLECTION_OBJECT_PTR(ce); if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &class_name) == FAILURE) { - return; + RETURN_THROWS(); } switch (Z_TYPE_P(class_name)) { @@ -4967,7 +5064,7 @@ ZEND_METHOD(reflection_class, isSubclassOf) if ((class_ce = zend_lookup_class(Z_STR_P(class_name))) == NULL) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s does not exist", Z_STRVAL_P(class_name)); - return; + RETURN_THROWS(); } break; case IS_OBJECT: @@ -4975,7 +5072,7 @@ ZEND_METHOD(reflection_class, isSubclassOf) argument = Z_REFLECTION_P(class_name); if (argument->ptr == NULL) { zend_throw_error(NULL, "Internal error: Failed to retrieve the argument's reflection object"); - return; + RETURN_THROWS(); } class_ce = argument->ptr; break; @@ -4984,7 +5081,7 @@ ZEND_METHOD(reflection_class, isSubclassOf) default: zend_throw_exception_ex(reflection_exception_ptr, 0, "Parameter one must either be a string or a ReflectionClass object"); - return; + RETURN_THROWS(); } RETURN_BOOL((ce != class_ce && instanceof_function(ce, class_ce))); @@ -5002,7 +5099,7 @@ ZEND_METHOD(reflection_class, implementsInterface) GET_REFLECTION_OBJECT_PTR(ce); if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &interface) == FAILURE) { - return; + RETURN_THROWS(); } switch (Z_TYPE_P(interface)) { @@ -5010,7 +5107,7 @@ ZEND_METHOD(reflection_class, implementsInterface) if ((interface_ce = zend_lookup_class(Z_STR_P(interface))) == NULL) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Interface %s does not exist", Z_STRVAL_P(interface)); - return; + RETURN_THROWS(); } break; case IS_OBJECT: @@ -5018,7 +5115,7 @@ ZEND_METHOD(reflection_class, implementsInterface) argument = Z_REFLECTION_P(interface); if (argument->ptr == NULL) { zend_throw_error(NULL, "Internal error: Failed to retrieve the argument's reflection object"); - return; + RETURN_THROWS(); } interface_ce = argument->ptr; break; @@ -5027,13 +5124,13 @@ ZEND_METHOD(reflection_class, implementsInterface) default: zend_throw_exception_ex(reflection_exception_ptr, 0, "Parameter one must either be a string or a ReflectionClass object"); - return; + RETURN_THROWS(); } if (!(interface_ce->ce_flags & ZEND_ACC_INTERFACE)) { zend_throw_exception_ex(reflection_exception_ptr, 0, "%s is not an interface", ZSTR_VAL(interface_ce->name)); - return; + RETURN_THROWS(); } RETURN_BOOL(instanceof_function(ce, interface_ce)); } @@ -5047,7 +5144,7 @@ ZEND_METHOD(reflection_class, isIterable) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); @@ -5069,7 +5166,7 @@ ZEND_METHOD(reflection_class, getExtension) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); @@ -5109,7 +5206,7 @@ ZEND_METHOD(reflection_class, inNamespace) const char *backslash; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if ((name = _default_load_name(ZEND_THIS)) == NULL) { RETURN_FALSE; @@ -5132,7 +5229,7 @@ ZEND_METHOD(reflection_class, getNamespaceName) const char *backslash; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if ((name = _default_load_name(ZEND_THIS)) == NULL) { RETURN_FALSE; @@ -5155,7 +5252,7 @@ ZEND_METHOD(reflection_class, getShortName) const char *backslash; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if ((name = _default_load_name(ZEND_THIS)) == NULL) { RETURN_FALSE; @@ -5215,8 +5312,8 @@ ZEND_METHOD(reflection_property, __construct) zend_property_info *property_info = NULL; property_reference *reference; - if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "zS", &classname, &name) == FAILURE) { - return; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zS", &classname, &name) == FAILURE) { + RETURN_THROWS(); } object = ZEND_THIS; @@ -5228,7 +5325,7 @@ ZEND_METHOD(reflection_property, __construct) if ((ce = zend_lookup_class(Z_STR_P(classname))) == NULL) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s does not exist", Z_STRVAL_P(classname)); - return; + RETURN_THROWS(); } break; @@ -5238,7 +5335,7 @@ ZEND_METHOD(reflection_property, __construct) default: _DO_THROW("The parameter class is expected to be either a string or an object"); - return; + RETURN_THROWS(); } property_info = zend_hash_find_ptr(&ce->properties_info, name); @@ -5247,25 +5344,13 @@ ZEND_METHOD(reflection_property, __construct) && property_info->ce != ce)) { /* Check for dynamic properties */ if (property_info == NULL && Z_TYPE_P(classname) == IS_OBJECT) { - if (zend_hash_exists(Z_OBJ_HT_P(classname)->get_properties(classname), name)) { + if (zend_hash_exists(Z_OBJ_HT_P(classname)->get_properties(Z_OBJ_P(classname)), name)) { dynam_prop = 1; } } if (dynam_prop == 0) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Property %s::$%s does not exist", ZSTR_VAL(ce->name), ZSTR_VAL(name)); - return; - } - } - - if (dynam_prop == 0 && (property_info->flags & ZEND_ACC_PRIVATE) == 0) { - /* we have to search the class hierarchy for this (implicit) public or protected property */ - zend_class_entry *tmp_ce = ce; - zend_property_info *tmp_info; - - while (tmp_ce && (tmp_info = zend_hash_find_ptr(&tmp_ce->properties_info, name)) == NULL) { - ce = tmp_ce; - property_info = tmp_info; - tmp_ce = tmp_ce->parent; + RETURN_THROWS(); } } @@ -5277,16 +5362,7 @@ ZEND_METHOD(reflection_property, __construct) } reference = (property_reference*) emalloc(sizeof(property_reference)); - if (dynam_prop) { - reference->prop.flags = ZEND_ACC_PUBLIC; - reference->prop.name = name; - reference->prop.doc_comment = NULL; - reference->prop.ce = ce; - reference->dynamic = 1; - } else { - reference->prop = *property_info; - reference->dynamic = 0; - } + reference->prop = dynam_prop ? NULL : property_info; reference->unmangled_name = zend_string_copy(name); intern->ptr = reference; intern->ref_type = REF_TYPE_PROPERTY; @@ -5304,10 +5380,10 @@ ZEND_METHOD(reflection_property, __toString) smart_str str = {0}; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ref); - _property_string(&str, &ref->prop, ZSTR_VAL(ref->unmangled_name), "", ref->dynamic); + _property_string(&str, ref->prop, ZSTR_VAL(ref->unmangled_name), ""); RETURN_STR(smart_str_extract(&str)); } /* }}} */ @@ -5317,7 +5393,7 @@ ZEND_METHOD(reflection_property, __toString) ZEND_METHOD(reflection_property, getName) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } _default_get_name(ZEND_THIS, return_value); } @@ -5329,10 +5405,10 @@ static void _property_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask) /* {{{ property_reference *ref; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ref); - RETURN_BOOL(ref->prop.flags & mask); + RETURN_BOOL(prop_get_flags(ref) & mask); } /* }}} */ @@ -5376,10 +5452,10 @@ ZEND_METHOD(reflection_property, isDefault) property_reference *ref; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ref); - RETURN_BOOL(!ref->dynamic); + RETURN_BOOL(ref->prop != NULL); } /* }}} */ @@ -5392,11 +5468,11 @@ ZEND_METHOD(reflection_property, getModifiers) uint32_t keep_flags = ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ref); - RETURN_LONG((ref->prop.flags & keep_flags)); + RETURN_LONG(prop_get_flags(ref) & keep_flags); } /* }}} */ @@ -5411,14 +5487,14 @@ ZEND_METHOD(reflection_property, getValue) GET_REFLECTION_OBJECT_PTR(ref); - if (!(ref->prop.flags & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) { + if (!(prop_get_flags(ref) & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) { name = _default_load_name(ZEND_THIS); zend_throw_exception_ex(reflection_exception_ptr, 0, "Cannot access non-public member %s::$%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name)); - return; + RETURN_THROWS(); } - if (ref->prop.flags & ZEND_ACC_STATIC) { + if (prop_get_flags(ref) & ZEND_ACC_STATIC) { member_p = zend_read_static_property_ex(intern->ce, ref->unmangled_name, 0); if (member_p) { ZVAL_COPY_DEREF(return_value, member_p); @@ -5427,12 +5503,13 @@ ZEND_METHOD(reflection_property, getValue) zval rv; if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &object) == FAILURE) { - return; + RETURN_THROWS(); } - if (!instanceof_function(Z_OBJCE_P(object), ref->prop.ce)) { + /* TODO: Should this always use intern->ce? */ + if (!instanceof_function(Z_OBJCE_P(object), ref->prop ? ref->prop->ce : intern->ce)) { _DO_THROW("Given object is not an instance of the class this property was declared in"); - return; + RETURN_THROWS(); } member_p = zend_read_property_ex(intern->ce, object, ref->unmangled_name, 0, &rv); @@ -5460,24 +5537,24 @@ ZEND_METHOD(reflection_property, setValue) GET_REFLECTION_OBJECT_PTR(ref); - if (!(ref->prop.flags & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) { + if (!(prop_get_flags(ref) & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) { name = _default_load_name(ZEND_THIS); zend_throw_exception_ex(reflection_exception_ptr, 0, "Cannot access non-public member %s::$%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name)); - return; + RETURN_THROWS(); } - if (ref->prop.flags & ZEND_ACC_STATIC) { + if (prop_get_flags(ref) & ZEND_ACC_STATIC) { if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "z", &value) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &tmp, &value) == FAILURE) { - return; + RETURN_THROWS(); } } zend_update_static_property_ex(intern->ce, ref->unmangled_name, value); } else { if (zend_parse_parameters(ZEND_NUM_ARGS(), "oz", &object, &value) == FAILURE) { - return; + RETURN_THROWS(); } zend_update_property_ex(intern->ce, object, ref->unmangled_name, value); @@ -5496,37 +5573,36 @@ ZEND_METHOD(reflection_property, isInitialized) GET_REFLECTION_OBJECT_PTR(ref); - if (!(ref->prop.flags & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) { + if (!(prop_get_flags(ref) & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) { name = _default_load_name(getThis()); zend_throw_exception_ex(reflection_exception_ptr, 0, "Cannot access non-public member %s::$%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name)); - return; + RETURN_THROWS(); } - if (ref->prop.flags & ZEND_ACC_STATIC) { + if (prop_get_flags(ref) & ZEND_ACC_STATIC) { member_p = zend_read_static_property_ex(intern->ce, ref->unmangled_name, 1); if (member_p) { - RETURN_BOOL(!Z_ISUNDEF_P(member_p)) + RETURN_BOOL(!Z_ISUNDEF_P(member_p)); } RETURN_FALSE; } else { - zval name_zv; zend_class_entry *old_scope; int retval; if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &object) == FAILURE) { - return; + RETURN_THROWS(); } - if (!instanceof_function(Z_OBJCE_P(object), ref->prop.ce)) { + /* TODO: Should this always use intern->ce? */ + if (!instanceof_function(Z_OBJCE_P(object), ref->prop ? ref->prop->ce : intern->ce)) { _DO_THROW("Given object is not an instance of the class this property was declared in"); - return; + RETURN_THROWS(); } old_scope = EG(fake_scope); EG(fake_scope) = intern->ce; - ZVAL_STR(&name_zv, ref->unmangled_name); - retval = Z_OBJ_HT_P(object)->has_property(object, &name_zv, ZEND_PROPERTY_EXISTS, NULL); + retval = Z_OBJ_HT_P(object)->has_property(Z_OBJ_P(object), ref->unmangled_name, ZEND_PROPERTY_EXISTS, NULL); EG(fake_scope) = old_scope; RETVAL_BOOL(retval); @@ -5544,7 +5620,7 @@ ZEND_METHOD(reflection_property, getDeclaringClass) zend_property_info *tmp_info; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ref); @@ -5574,11 +5650,11 @@ ZEND_METHOD(reflection_property, getDocComment) property_reference *ref; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ref); - if (ref->prop.doc_comment) { - RETURN_STR_COPY(ref->prop.doc_comment); + if (ref->prop && ref->prop->doc_comment) { + RETURN_STR_COPY(ref->prop->doc_comment); } RETURN_FALSE; } @@ -5592,7 +5668,7 @@ ZEND_METHOD(reflection_property, setAccessible) zend_bool visible; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &visible) == FAILURE) { - return; + RETURN_THROWS(); } intern = Z_REFLECTION_P(ZEND_THIS); @@ -5609,16 +5685,16 @@ ZEND_METHOD(reflection_property, getType) property_reference *ref; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ref); - if (!ZEND_TYPE_IS_SET(ref->prop.type)) { + if (!ref->prop || !ZEND_TYPE_IS_SET(ref->prop->type)) { RETURN_NULL(); } - reflection_type_factory(ref->prop.type, return_value); + reflection_type_factory(ref->prop->type, return_value, 1); } /* }}} */ @@ -5630,12 +5706,12 @@ ZEND_METHOD(reflection_property, hasType) property_reference *ref; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ref); - RETVAL_BOOL(ZEND_TYPE_IS_SET(ref->prop.type)); + RETVAL_BOOL(ref->prop && ZEND_TYPE_IS_SET(ref->prop->type)); } /* }}} */ @@ -5659,8 +5735,8 @@ ZEND_METHOD(reflection_extension, __construct) size_t name_len; ALLOCA_FLAG(use_heap) - if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s", &name_str, &name_len) == FAILURE) { - return; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name_str, &name_len) == FAILURE) { + RETURN_THROWS(); } object = ZEND_THIS; @@ -5671,7 +5747,7 @@ ZEND_METHOD(reflection_extension, __construct) free_alloca(lcname, use_heap); zend_throw_exception_ex(reflection_exception_ptr, 0, "Extension %s does not exist", name_str); - return; + RETURN_THROWS(); } free_alloca(lcname, use_heap); ZVAL_STRING(reflection_prop_name(object), module->name); @@ -5690,7 +5766,7 @@ ZEND_METHOD(reflection_extension, __toString) smart_str str = {0}; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(module); _extension_string(&str, module, ""); @@ -5703,7 +5779,7 @@ ZEND_METHOD(reflection_extension, __toString) ZEND_METHOD(reflection_extension, getName) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } _default_get_name(ZEND_THIS, return_value); } @@ -5717,7 +5793,7 @@ ZEND_METHOD(reflection_extension, getVersion) zend_module_entry *module; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(module); @@ -5740,7 +5816,7 @@ ZEND_METHOD(reflection_extension, getFunctions) zend_function *fptr; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(module); @@ -5764,7 +5840,7 @@ ZEND_METHOD(reflection_extension, getConstants) zend_constant *constant; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(module); @@ -5803,7 +5879,7 @@ ZEND_METHOD(reflection_extension, getINIEntries) zend_ini_entry *ini_entry; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(module); @@ -5848,7 +5924,7 @@ ZEND_METHOD(reflection_extension, getClasses) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(module); @@ -5869,7 +5945,7 @@ ZEND_METHOD(reflection_extension, getClassNames) zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(module); @@ -5889,7 +5965,7 @@ ZEND_METHOD(reflection_extension, getDependencies) const zend_module_dep *dep; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(module); @@ -5954,7 +6030,7 @@ ZEND_METHOD(reflection_extension, info) zend_module_entry *module; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(module); @@ -5970,7 +6046,7 @@ ZEND_METHOD(reflection_extension, isPersistent) zend_module_entry *module; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(module); @@ -5986,7 +6062,7 @@ ZEND_METHOD(reflection_extension, isTemporary) zend_module_entry *module; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(module); @@ -6012,8 +6088,8 @@ ZEND_METHOD(reflection_zend_extension, __construct) char *name_str; size_t name_len; - if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s", &name_str, &name_len) == FAILURE) { - return; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name_str, &name_len) == FAILURE) { + RETURN_THROWS(); } object = ZEND_THIS; @@ -6023,7 +6099,7 @@ ZEND_METHOD(reflection_zend_extension, __construct) if (!extension) { zend_throw_exception_ex(reflection_exception_ptr, 0, "Zend Extension %s does not exist", name_str); - return; + RETURN_THROWS(); } ZVAL_STRING(reflection_prop_name(object), extension->name); intern->ptr = extension; @@ -6041,7 +6117,7 @@ ZEND_METHOD(reflection_zend_extension, __toString) smart_str str = {0}; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(extension); _zend_extension_string(&str, extension, ""); @@ -6057,7 +6133,7 @@ ZEND_METHOD(reflection_zend_extension, getName) zend_extension *extension; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(extension); @@ -6073,7 +6149,7 @@ ZEND_METHOD(reflection_zend_extension, getVersion) zend_extension *extension; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(extension); @@ -6093,7 +6169,7 @@ ZEND_METHOD(reflection_zend_extension, getAuthor) zend_extension *extension; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(extension); @@ -6113,7 +6189,7 @@ ZEND_METHOD(reflection_zend_extension, getURL) zend_extension *extension; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(extension); @@ -6133,7 +6209,7 @@ ZEND_METHOD(reflection_zend_extension, getCopyright) zend_extension *extension; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(extension); @@ -6174,8 +6250,8 @@ ZEND_METHOD(reflection_reference, fromArrayElement) zval *key, *item; reflection_object *intern; - if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "hz", &ht, &key) == FAILURE) { - return; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "hz", &ht, &key) == FAILURE) { + RETURN_THROWS(); } if (Z_TYPE_P(key) == IS_LONG) { @@ -6184,12 +6260,12 @@ ZEND_METHOD(reflection_reference, fromArrayElement) item = zend_symtable_find(ht, Z_STR_P(key)); } else { zend_type_error("Key must be array or string"); - return; + RETURN_THROWS(); } if (!item) { _DO_THROW("Array key not found"); - return; + RETURN_THROWS(); } if (Z_TYPE_P(item) != IS_REFERENCE || is_ignorable_reference(ht, item)) { @@ -6213,13 +6289,13 @@ ZEND_METHOD(reflection_reference, getId) PHP_SHA1_CTX context; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } intern = Z_REFLECTION_P(getThis()); if (Z_TYPE(intern->obj) != IS_REFERENCE) { _DO_THROW("Corrupted ReflectionReference object"); - return; + RETURN_THROWS(); } if (!REFLECTION_G(key_initialized)) { @@ -6245,493 +6321,277 @@ static const zend_function_entry reflection_exception_functions[] = { PHP_FE_END }; -ZEND_BEGIN_ARG_INFO(arginfo_reflection__void, 0) -ZEND_END_ARG_INFO() - - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_getModifierNames, 0) - ZEND_ARG_INFO(0, modifiers) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_export, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, reflector, Reflector, 0) - ZEND_ARG_INFO(0, return) -ZEND_END_ARG_INFO() - static const zend_function_entry reflection_functions[] = { - ZEND_ME(reflection, getModifierNames, arginfo_reflection_getModifierNames, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - ZEND_DEP_ME(reflection, export, arginfo_reflection_export, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME(reflection, getModifierNames, arginfo_class_Reflection_getModifierNames, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_DEP_ME(reflection, export, arginfo_class_Reflection_export, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END }; static const zend_function_entry reflector_functions[] = { - ZEND_ABSTRACT_ME(reflector, __toString, arginfo_reflection__void) + ZEND_ABSTRACT_ME(reflector, __toString, arginfo_class_Reflector___toString) PHP_FE_END }; -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_function_export, 0, 0, 1) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, return) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_function___construct, 0) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_function_invoke, 0, 0, 0) - ZEND_ARG_INFO(0, args) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_function_invokeArgs, 0) - ZEND_ARG_ARRAY_INFO(0, args, 0) -ZEND_END_ARG_INFO() - static const zend_function_entry reflection_function_abstract_functions[] = { - ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) - ZEND_ME(reflection_function, inNamespace, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, isClosure, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, isDeprecated, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, isInternal, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, isUserDefined, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, isGenerator, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, isVariadic, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, getClosureThis, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, getClosureScopeClass, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, getDocComment, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, getEndLine, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, getExtension, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, getExtensionName, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, getFileName, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, getName, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, getNamespaceName, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, getNumberOfParameters, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, getNumberOfRequiredParameters, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, getParameters, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, getShortName, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, getStartLine, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, getStaticVariables, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, returnsReference, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, hasReturnType, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, getReturnType, arginfo_reflection__void, 0) + ZEND_ME(reflection, __clone, arginfo_class_ReflectionFunctionAbstract___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) + ZEND_ME(reflection_function, inNamespace, arginfo_class_ReflectionFunctionAbstract_inNamespace, 0) + ZEND_ME(reflection_function, isClosure, arginfo_class_ReflectionFunctionAbstract_isClosure, 0) + ZEND_ME(reflection_function, isDeprecated, arginfo_class_ReflectionFunctionAbstract_isDeprecated, 0) + ZEND_ME(reflection_function, isInternal, arginfo_class_ReflectionFunctionAbstract_isInternal, 0) + ZEND_ME(reflection_function, isUserDefined, arginfo_class_ReflectionFunctionAbstract_isUserDefined, 0) + ZEND_ME(reflection_function, isGenerator, arginfo_class_ReflectionFunctionAbstract_isGenerator, 0) + ZEND_ME(reflection_function, isVariadic, arginfo_class_ReflectionFunctionAbstract_isVariadic, 0) + ZEND_ME(reflection_function, getClosureThis, arginfo_class_ReflectionFunctionAbstract_getClosureThis, 0) + ZEND_ME(reflection_function, getClosureScopeClass, arginfo_class_ReflectionFunctionAbstract_getClosureScopeClass, 0) + ZEND_ME(reflection_function, getDocComment, arginfo_class_ReflectionFunctionAbstract_getDocComment, 0) + ZEND_ME(reflection_function, getEndLine, arginfo_class_ReflectionFunctionAbstract_getEndLine, 0) + ZEND_ME(reflection_function, getExtension, arginfo_class_ReflectionFunctionAbstract_getExtension, 0) + ZEND_ME(reflection_function, getExtensionName, arginfo_class_ReflectionFunctionAbstract_getExtensionName, 0) + ZEND_ME(reflection_function, getFileName, arginfo_class_ReflectionFunctionAbstract_getFileName, 0) + ZEND_ME(reflection_function, getName, arginfo_class_ReflectionFunctionAbstract_getName, 0) + ZEND_ME(reflection_function, getNamespaceName, arginfo_class_ReflectionFunctionAbstract_getNamespaceName, 0) + ZEND_ME(reflection_function, getNumberOfParameters, arginfo_class_ReflectionFunctionAbstract_getNumberOfParameters, 0) + ZEND_ME(reflection_function, getNumberOfRequiredParameters, arginfo_class_ReflectionFunctionAbstract_getNumberOfRequiredParameters, 0) + ZEND_ME(reflection_function, getParameters, arginfo_class_ReflectionFunctionAbstract_getParameters, 0) + ZEND_ME(reflection_function, getShortName, arginfo_class_ReflectionFunctionAbstract_getShortName, 0) + ZEND_ME(reflection_function, getStartLine, arginfo_class_ReflectionFunctionAbstract_getStartLine, 0) + ZEND_ME(reflection_function, getStaticVariables, arginfo_class_ReflectionFunctionAbstract_getStaticVariables, 0) + ZEND_ME(reflection_function, returnsReference, arginfo_class_ReflectionFunctionAbstract_returnsReference, 0) + ZEND_ME(reflection_function, hasReturnType, arginfo_class_ReflectionFunctionAbstract_hasReturnType, 0) + ZEND_ME(reflection_function, getReturnType, arginfo_class_ReflectionFunctionAbstract_getReturnType, 0) PHP_FE_END }; static const zend_function_entry reflection_function_functions[] = { - ZEND_ME(reflection_function, __construct, arginfo_reflection_function___construct, 0) - ZEND_ME(reflection_function, __toString, arginfo_reflection__void, 0) - ZEND_DEP_ME(reflection_function, export, arginfo_reflection_function_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) - ZEND_ME(reflection_function, isDisabled, arginfo_reflection__void, 0) - ZEND_ME(reflection_function, invoke, arginfo_reflection_function_invoke, 0) - ZEND_ME(reflection_function, invokeArgs, arginfo_reflection_function_invokeArgs, 0) - ZEND_ME(reflection_function, getClosure, arginfo_reflection__void, 0) + ZEND_ME(reflection_function, __construct, arginfo_class_ReflectionFunction___construct, 0) + ZEND_ME(reflection_function, __toString, arginfo_class_ReflectionFunction___toString, 0) + ZEND_DEP_ME(reflection_function, export, arginfo_class_ReflectionFunction_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + ZEND_ME(reflection_function, isDisabled, arginfo_class_ReflectionFunction_isDisabled, 0) + ZEND_ME(reflection_function, invoke, arginfo_class_ReflectionFunction_invoke, 0) + ZEND_ME(reflection_function, invokeArgs, arginfo_class_ReflectionFunction_invokeArgs, 0) + ZEND_ME(reflection_function, getClosure, arginfo_class_ReflectionFunction_getClosure, 0) PHP_FE_END }; -ZEND_BEGIN_ARG_INFO(arginfo_reflection_generator___construct, 0) - ZEND_ARG_INFO(0, generator) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_generator_trace, 0, 0, 0) - ZEND_ARG_INFO(0, options) -ZEND_END_ARG_INFO() - static const zend_function_entry reflection_generator_functions[] = { - ZEND_ME(reflection_generator, __construct, arginfo_reflection_generator___construct, 0) - ZEND_ME(reflection_generator, getExecutingLine, arginfo_reflection__void, 0) - ZEND_ME(reflection_generator, getExecutingFile, arginfo_reflection__void, 0) - ZEND_ME(reflection_generator, getTrace, arginfo_reflection_generator_trace, 0) - ZEND_ME(reflection_generator, getFunction, arginfo_reflection__void, 0) - ZEND_ME(reflection_generator, getThis, arginfo_reflection__void, 0) - ZEND_ME(reflection_generator, getExecutingGenerator, arginfo_reflection__void, 0) + ZEND_ME(reflection_generator, __construct, arginfo_class_ReflectionGenerator___construct, 0) + ZEND_ME(reflection_generator, getExecutingLine, arginfo_class_ReflectionGenerator_getExecutingLine, 0) + ZEND_ME(reflection_generator, getExecutingFile, arginfo_class_ReflectionGenerator_getExecutingFile, 0) + ZEND_ME(reflection_generator, getTrace, arginfo_class_ReflectionGenerator_getTrace, 0) + ZEND_ME(reflection_generator, getFunction, arginfo_class_ReflectionGenerator_getFunction, 0) + ZEND_ME(reflection_generator, getThis, arginfo_class_ReflectionGenerator_getThis, 0) + ZEND_ME(reflection_generator, getExecutingGenerator, arginfo_class_ReflectionGenerator_getExecutingGenerator, 0) PHP_FE_END }; -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_method_export, 0, 0, 2) - ZEND_ARG_INFO(0, class) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, return) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_method___construct, 0, 0, 1) - ZEND_ARG_INFO(0, class_or_method) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_method_invoke, 0) - ZEND_ARG_INFO(0, object) - ZEND_ARG_INFO(0, args) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_method_invokeArgs, 0) - ZEND_ARG_INFO(0, object) - ZEND_ARG_ARRAY_INFO(0, args, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_method_setAccessible, 0) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_method_getClosure, 0, 0, 0) - ZEND_ARG_INFO(0, object) -ZEND_END_ARG_INFO() - static const zend_function_entry reflection_method_functions[] = { - ZEND_DEP_ME(reflection_method, export, arginfo_reflection_method_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) - ZEND_ME(reflection_method, __construct, arginfo_reflection_method___construct, 0) - ZEND_ME(reflection_method, __toString, arginfo_reflection__void, 0) - ZEND_ME(reflection_method, isPublic, arginfo_reflection__void, 0) - ZEND_ME(reflection_method, isPrivate, arginfo_reflection__void, 0) - ZEND_ME(reflection_method, isProtected, arginfo_reflection__void, 0) - ZEND_ME(reflection_method, isAbstract, arginfo_reflection__void, 0) - ZEND_ME(reflection_method, isFinal, arginfo_reflection__void, 0) - ZEND_ME(reflection_method, isStatic, arginfo_reflection__void, 0) - ZEND_ME(reflection_method, isConstructor, arginfo_reflection__void, 0) - ZEND_ME(reflection_method, isDestructor, arginfo_reflection__void, 0) - ZEND_ME(reflection_method, getClosure, arginfo_reflection_method_getClosure, 0) - ZEND_ME(reflection_method, getModifiers, arginfo_reflection__void, 0) - ZEND_ME(reflection_method, invoke, arginfo_reflection_method_invoke, 0) - ZEND_ME(reflection_method, invokeArgs, arginfo_reflection_method_invokeArgs, 0) - ZEND_ME(reflection_method, getDeclaringClass, arginfo_reflection__void, 0) - ZEND_ME(reflection_method, getPrototype, arginfo_reflection__void, 0) - ZEND_ME(reflection_method, setAccessible, arginfo_reflection_method_setAccessible, 0) + ZEND_DEP_ME(reflection_method, export, arginfo_class_ReflectionMethod_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + ZEND_ME(reflection_method, __construct, arginfo_class_ReflectionMethod___construct, 0) + ZEND_ME(reflection_method, __toString, arginfo_class_ReflectionMethod___toString, 0) + ZEND_ME(reflection_method, isPublic, arginfo_class_ReflectionMethod_isPublic, 0) + ZEND_ME(reflection_method, isPrivate, arginfo_class_ReflectionMethod_isPrivate, 0) + ZEND_ME(reflection_method, isProtected, arginfo_class_ReflectionMethod_isProtected, 0) + ZEND_ME(reflection_method, isAbstract, arginfo_class_ReflectionMethod_isAbstract, 0) + ZEND_ME(reflection_method, isFinal, arginfo_class_ReflectionMethod_isFinal, 0) + ZEND_ME(reflection_method, isStatic, arginfo_class_ReflectionMethod_isStatic, 0) + ZEND_ME(reflection_method, isConstructor, arginfo_class_ReflectionMethod_isConstructor, 0) + ZEND_ME(reflection_method, isDestructor, arginfo_class_ReflectionMethod_isDestructor, 0) + ZEND_ME(reflection_method, getClosure, arginfo_class_ReflectionMethod_getClosure, 0) + ZEND_ME(reflection_method, getModifiers, arginfo_class_ReflectionMethod_getModifiers, 0) + ZEND_ME(reflection_method, invoke, arginfo_class_ReflectionMethod_invoke, 0) + ZEND_ME(reflection_method, invokeArgs, arginfo_class_ReflectionMethod_invokeArgs, 0) + ZEND_ME(reflection_method, getDeclaringClass, arginfo_class_ReflectionMethod_getDeclaringClass, 0) + ZEND_ME(reflection_method, getPrototype, arginfo_class_ReflectionMethod_getPrototype, 0) + ZEND_ME(reflection_method, setAccessible, arginfo_class_ReflectionMethod_setAccessible, 0) PHP_FE_END }; - -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_export, 0, 0, 1) - ZEND_ARG_INFO(0, argument) - ZEND_ARG_INFO(0, return) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_class___construct, 0) - ZEND_ARG_INFO(0, argument) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_getStaticPropertyValue, 0, 0, 1) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, default) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_setStaticPropertyValue, 0) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_hasMethod, 0) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_getMethod, 0) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_getMethods, 0, 0, 0) - ZEND_ARG_INFO(0, filter) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_hasProperty, 0) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_getProperty, 0) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_getProperties, 0, 0, 0) - ZEND_ARG_INFO(0, filter) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_hasConstant, 0) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_getConstant, 0) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_isInstance, 0) - ZEND_ARG_INFO(0, object) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_newInstance, 0) - ZEND_ARG_INFO(0, args) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_newInstanceWithoutConstructor, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_newInstanceArgs, 0, 0, 0) - ZEND_ARG_ARRAY_INFO(0, args, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_isSubclassOf, 0) - ZEND_ARG_INFO(0, class) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_implementsInterface, 0) - ZEND_ARG_INFO(0, interface) -ZEND_END_ARG_INFO() - static const zend_function_entry reflection_class_functions[] = { - ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) - ZEND_DEP_ME(reflection_class, export, arginfo_reflection_class_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) - ZEND_ME(reflection_class, __construct, arginfo_reflection_class___construct, 0) - ZEND_ME(reflection_class, __toString, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, getName, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, isInternal, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, isUserDefined, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, isAnonymous, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, isInstantiable, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, isCloneable, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, getFileName, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, getStartLine, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, getEndLine, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, getDocComment, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, getConstructor, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, hasMethod, arginfo_reflection_class_hasMethod, 0) - ZEND_ME(reflection_class, getMethod, arginfo_reflection_class_getMethod, 0) - ZEND_ME(reflection_class, getMethods, arginfo_reflection_class_getMethods, 0) - ZEND_ME(reflection_class, hasProperty, arginfo_reflection_class_hasProperty, 0) - ZEND_ME(reflection_class, getProperty, arginfo_reflection_class_getProperty, 0) - ZEND_ME(reflection_class, getProperties, arginfo_reflection_class_getProperties, 0) - ZEND_ME(reflection_class, hasConstant, arginfo_reflection_class_hasConstant, 0) - ZEND_ME(reflection_class, getConstants, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, getReflectionConstants, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, getConstant, arginfo_reflection_class_getConstant, 0) - ZEND_ME(reflection_class, getReflectionConstant, arginfo_reflection_class_getConstant, 0) - ZEND_ME(reflection_class, getInterfaces, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, getInterfaceNames, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, isInterface, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, getTraits, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, getTraitNames, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, getTraitAliases, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, isTrait, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, isAbstract, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, isFinal, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, getModifiers, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, isInstance, arginfo_reflection_class_isInstance, 0) - ZEND_ME(reflection_class, newInstance, arginfo_reflection_class_newInstance, 0) - ZEND_ME(reflection_class, newInstanceWithoutConstructor, arginfo_reflection_class_newInstanceWithoutConstructor, 0) - ZEND_ME(reflection_class, newInstanceArgs, arginfo_reflection_class_newInstanceArgs, 0) - ZEND_ME(reflection_class, getParentClass, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, isSubclassOf, arginfo_reflection_class_isSubclassOf, 0) - ZEND_ME(reflection_class, getStaticProperties, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, getStaticPropertyValue, arginfo_reflection_class_getStaticPropertyValue, 0) - ZEND_ME(reflection_class, setStaticPropertyValue, arginfo_reflection_class_setStaticPropertyValue, 0) - ZEND_ME(reflection_class, getDefaultProperties, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, isIterable, arginfo_reflection__void, 0) - ZEND_MALIAS(reflection_class, isIterateable, isIterable, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, implementsInterface, arginfo_reflection_class_implementsInterface, 0) - ZEND_ME(reflection_class, getExtension, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, getExtensionName, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, inNamespace, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, getNamespaceName, arginfo_reflection__void, 0) - ZEND_ME(reflection_class, getShortName, arginfo_reflection__void, 0) + ZEND_ME(reflection, __clone, arginfo_class_ReflectionClass___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) + ZEND_DEP_ME(reflection_class, export, arginfo_class_ReflectionClass_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + ZEND_ME(reflection_class, __construct, arginfo_class_ReflectionClass___construct, 0) + ZEND_ME(reflection_class, __toString, arginfo_class_ReflectionClass___toString, 0) + ZEND_ME(reflection_class, getName, arginfo_class_ReflectionClass_getName, 0) + ZEND_ME(reflection_class, isInternal, arginfo_class_ReflectionClass_isInternal, 0) + ZEND_ME(reflection_class, isUserDefined, arginfo_class_ReflectionClass_isUserDefined, 0) + ZEND_ME(reflection_class, isAnonymous, arginfo_class_ReflectionClass_isAnonymous, 0) + ZEND_ME(reflection_class, isInstantiable, arginfo_class_ReflectionClass_isInstantiable, 0) + ZEND_ME(reflection_class, isCloneable, arginfo_class_ReflectionClass_isCloneable, 0) + ZEND_ME(reflection_class, getFileName, arginfo_class_ReflectionClass_getFileName, 0) + ZEND_ME(reflection_class, getStartLine, arginfo_class_ReflectionClass_getStartLine, 0) + ZEND_ME(reflection_class, getEndLine, arginfo_class_ReflectionClass_getEndLine, 0) + ZEND_ME(reflection_class, getDocComment, arginfo_class_ReflectionClass_getDocComment, 0) + ZEND_ME(reflection_class, getConstructor, arginfo_class_ReflectionClass_getConstructor, 0) + ZEND_ME(reflection_class, hasMethod, arginfo_class_ReflectionClass_hasMethod, 0) + ZEND_ME(reflection_class, getMethod, arginfo_class_ReflectionClass_getMethod, 0) + ZEND_ME(reflection_class, getMethods, arginfo_class_ReflectionClass_getMethods, 0) + ZEND_ME(reflection_class, hasProperty, arginfo_class_ReflectionClass_hasProperty, 0) + ZEND_ME(reflection_class, getProperty, arginfo_class_ReflectionClass_getProperty, 0) + ZEND_ME(reflection_class, getProperties, arginfo_class_ReflectionClass_getProperties, 0) + ZEND_ME(reflection_class, hasConstant, arginfo_class_ReflectionClass_hasConstant, 0) + ZEND_ME(reflection_class, getConstants, arginfo_class_ReflectionClass_getConstants, 0) + ZEND_ME(reflection_class, getReflectionConstants, arginfo_class_ReflectionClass_getReflectionConstants, 0) + ZEND_ME(reflection_class, getConstant, arginfo_class_ReflectionClass_getConstant, 0) + ZEND_ME(reflection_class, getReflectionConstant, arginfo_class_ReflectionClass_getReflectionConstant, 0) + ZEND_ME(reflection_class, getInterfaces, arginfo_class_ReflectionClass_getInterfaces, 0) + ZEND_ME(reflection_class, getInterfaceNames, arginfo_class_ReflectionClass_getInterfaceNames, 0) + ZEND_ME(reflection_class, isInterface, arginfo_class_ReflectionClass_isInterface, 0) + ZEND_ME(reflection_class, getTraits, arginfo_class_ReflectionClass_getTraits, 0) + ZEND_ME(reflection_class, getTraitNames, arginfo_class_ReflectionClass_getTraitNames, 0) + ZEND_ME(reflection_class, getTraitAliases, arginfo_class_ReflectionClass_getTraitAliases, 0) + ZEND_ME(reflection_class, isTrait, arginfo_class_ReflectionClass_isTrait, 0) + ZEND_ME(reflection_class, isAbstract, arginfo_class_ReflectionClass_isAbstract, 0) + ZEND_ME(reflection_class, isFinal, arginfo_class_ReflectionClass_isFinal, 0) + ZEND_ME(reflection_class, getModifiers, arginfo_class_ReflectionClass_getModifiers, 0) + ZEND_ME(reflection_class, isInstance, arginfo_class_ReflectionClass_isIntance, 0) + ZEND_ME(reflection_class, newInstance, arginfo_class_ReflectionClass_newInstance, 0) + ZEND_ME(reflection_class, newInstanceWithoutConstructor, arginfo_class_ReflectionClass_newInstanceWithoutConstructor, 0) + ZEND_ME(reflection_class, newInstanceArgs, arginfo_class_ReflectionClass_newInstanceArgs, 0) + ZEND_ME(reflection_class, getParentClass, arginfo_class_ReflectionClass_getParentClass, 0) + ZEND_ME(reflection_class, isSubclassOf, arginfo_class_ReflectionClass_isSubclassOf, 0) + ZEND_ME(reflection_class, getStaticProperties, arginfo_class_ReflectionClass_getStaticProperties, 0) + ZEND_ME(reflection_class, getStaticPropertyValue, arginfo_class_ReflectionClass_getStaticPropertyValue, 0) + ZEND_ME(reflection_class, setStaticPropertyValue, arginfo_class_ReflectionClass_setStaticPropertyValue, 0) + ZEND_ME(reflection_class, getDefaultProperties, arginfo_class_ReflectionClass_getDefaultProperties, 0) + ZEND_ME(reflection_class, isIterable, arginfo_class_ReflectionClass_isIterable, 0) + ZEND_MALIAS(reflection_class, isIterateable, isIterable, arginfo_class_ReflectionClass_isIterateable, 0) + ZEND_ME(reflection_class, implementsInterface, arginfo_class_ReflectionClass_implementsInterface, 0) + ZEND_ME(reflection_class, getExtension, arginfo_class_ReflectionClass_getExtension, 0) + ZEND_ME(reflection_class, getExtensionName, arginfo_class_ReflectionClass_getExtensionName, 0) + ZEND_ME(reflection_class, inNamespace, arginfo_class_ReflectionClass_inNamespace, 0) + ZEND_ME(reflection_class, getNamespaceName, arginfo_class_ReflectionClass_getNamespaceName, 0) + ZEND_ME(reflection_class, getShortName, arginfo_class_ReflectionClass_getShortName, 0) PHP_FE_END }; - -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_object_export, 0, 0, 1) - ZEND_ARG_INFO(0, argument) - ZEND_ARG_INFO(0, return) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_object___construct, 0) - ZEND_ARG_INFO(0, argument) -ZEND_END_ARG_INFO() - static const zend_function_entry reflection_object_functions[] = { - ZEND_DEP_ME(reflection_object, export, arginfo_reflection_object_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) - ZEND_ME(reflection_object, __construct, arginfo_reflection_object___construct, 0) + ZEND_DEP_ME(reflection_object, export, arginfo_class_ReflectionObject_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + ZEND_ME(reflection_object, __construct, arginfo_class_ReflectionObject___construct, 0) PHP_FE_END }; - -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_property_export, 0, 0, 2) - ZEND_ARG_INFO(0, class) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, return) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_property___construct, 0, 0, 2) - ZEND_ARG_INFO(0, class) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_property_getValue, 0, 0, 0) - ZEND_ARG_INFO(0, object) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_property_setValue, 0, 0, 1) - ZEND_ARG_INFO(0, object) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_property_isInitialized, 0, 0, 0) - ZEND_ARG_INFO(0, object) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_property_setAccessible, 0) - ZEND_ARG_INFO(0, visible) -ZEND_END_ARG_INFO() - static const zend_function_entry reflection_property_functions[] = { - ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) - ZEND_DEP_ME(reflection_property, export, arginfo_reflection_property_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) - ZEND_ME(reflection_property, __construct, arginfo_reflection_property___construct, 0) - ZEND_ME(reflection_property, __toString, arginfo_reflection__void, 0) - ZEND_ME(reflection_property, getName, arginfo_reflection__void, 0) - ZEND_ME(reflection_property, getValue, arginfo_reflection_property_getValue, 0) - ZEND_ME(reflection_property, setValue, arginfo_reflection_property_setValue, 0) - ZEND_ME(reflection_property, isInitialized, arginfo_reflection_property_isInitialized, 0) - ZEND_ME(reflection_property, isPublic, arginfo_reflection__void, 0) - ZEND_ME(reflection_property, isPrivate, arginfo_reflection__void, 0) - ZEND_ME(reflection_property, isProtected, arginfo_reflection__void, 0) - ZEND_ME(reflection_property, isStatic, arginfo_reflection__void, 0) - ZEND_ME(reflection_property, isDefault, arginfo_reflection__void, 0) - ZEND_ME(reflection_property, getModifiers, arginfo_reflection__void, 0) - ZEND_ME(reflection_property, getDeclaringClass, arginfo_reflection__void, 0) - ZEND_ME(reflection_property, getDocComment, arginfo_reflection__void, 0) - ZEND_ME(reflection_property, setAccessible, arginfo_reflection_property_setAccessible, 0) - ZEND_ME(reflection_property, getType, arginfo_reflection__void, 0) - ZEND_ME(reflection_property, hasType, arginfo_reflection__void, 0) + ZEND_ME(reflection, __clone, arginfo_class_ReflectionProperty___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) + ZEND_DEP_ME(reflection_property, export, arginfo_class_ReflectionProperty_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + ZEND_ME(reflection_property, __construct, arginfo_class_ReflectionProperty___construct, 0) + ZEND_ME(reflection_property, __toString, arginfo_class_ReflectionProperty___toString, 0) + ZEND_ME(reflection_property, getName, arginfo_class_ReflectionProperty_getName, 0) + ZEND_ME(reflection_property, getValue, arginfo_class_ReflectionProperty_getValue, 0) + ZEND_ME(reflection_property, setValue, arginfo_class_ReflectionProperty_setValue, 0) + ZEND_ME(reflection_property, isInitialized, arginfo_class_ReflectionProperty_isInitialized, 0) + ZEND_ME(reflection_property, isPublic, arginfo_class_ReflectionProperty_isPublic, 0) + ZEND_ME(reflection_property, isPrivate, arginfo_class_ReflectionProperty_isPrivate, 0) + ZEND_ME(reflection_property, isProtected, arginfo_class_ReflectionProperty_isProtected, 0) + ZEND_ME(reflection_property, isStatic, arginfo_class_ReflectionProperty_isStatic, 0) + ZEND_ME(reflection_property, isDefault, arginfo_class_ReflectionProperty_isDefault, 0) + ZEND_ME(reflection_property, getModifiers, arginfo_class_ReflectionProperty_getModifiers, 0) + ZEND_ME(reflection_property, getDeclaringClass, arginfo_class_ReflectionProperty_getDeclaringClass, 0) + ZEND_ME(reflection_property, getDocComment, arginfo_class_ReflectionProperty_getDocComment, 0) + ZEND_ME(reflection_property, setAccessible, arginfo_class_ReflectionProperty_setAccessible, 0) + ZEND_ME(reflection_property, getType, arginfo_class_ReflectionProperty_getType, 0) + ZEND_ME(reflection_property, hasType, arginfo_class_ReflectionProperty_hasType, 0) PHP_FE_END }; -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_constant_export, 0, 0, 2) - ZEND_ARG_INFO(0, class) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, return) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_constant___construct, 0, 0, 2) - ZEND_ARG_INFO(0, class) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - static const zend_function_entry reflection_class_constant_functions[] = { - ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) - ZEND_DEP_ME(reflection_class_constant, export, arginfo_reflection_class_constant_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) - ZEND_ME(reflection_class_constant, __construct, arginfo_reflection_class_constant___construct, 0) - ZEND_ME(reflection_class_constant, __toString, arginfo_reflection__void, 0) - ZEND_ME(reflection_class_constant, getName, arginfo_reflection__void, 0) - ZEND_ME(reflection_class_constant, getValue, arginfo_reflection__void, 0) - ZEND_ME(reflection_class_constant, isPublic, arginfo_reflection__void, 0) - ZEND_ME(reflection_class_constant, isPrivate, arginfo_reflection__void, 0) - ZEND_ME(reflection_class_constant, isProtected, arginfo_reflection__void, 0) - ZEND_ME(reflection_class_constant, getModifiers, arginfo_reflection__void, 0) - ZEND_ME(reflection_class_constant, getDeclaringClass, arginfo_reflection__void, 0) - ZEND_ME(reflection_class_constant, getDocComment, arginfo_reflection__void, 0) + ZEND_ME(reflection, __clone, arginfo_class_ReflectionClassConstant___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) + ZEND_DEP_ME(reflection_class_constant, export, arginfo_class_ReflectionClassConstant_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + ZEND_ME(reflection_class_constant, __construct, arginfo_class_ReflectionClassConstant___construct, 0) + ZEND_ME(reflection_class_constant, __toString, arginfo_class_ReflectionClassConstant___toString, 0) + ZEND_ME(reflection_class_constant, getName, arginfo_class_ReflectionClassConstant_getName, 0) + ZEND_ME(reflection_class_constant, getValue, arginfo_class_ReflectionClassConstant_getValue, 0) + ZEND_ME(reflection_class_constant, isPublic, arginfo_class_ReflectionClassConstant_isPublic, 0) + ZEND_ME(reflection_class_constant, isPrivate, arginfo_class_ReflectionClassConstant_isPrivate, 0) + ZEND_ME(reflection_class_constant, isProtected, arginfo_class_ReflectionClassConstant_isProtected, 0) + ZEND_ME(reflection_class_constant, getModifiers, arginfo_class_ReflectionClassConstant_getModifiers, 0) + ZEND_ME(reflection_class_constant, getDeclaringClass, arginfo_class_ReflectionClassConstant_getDeclaringClass, 0) + ZEND_ME(reflection_class_constant, getDocComment, arginfo_class_ReflectionClassConstant_getDocComment, 0) PHP_FE_END }; -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_parameter_export, 0, 0, 2) - ZEND_ARG_INFO(0, function) - ZEND_ARG_INFO(0, parameter) - ZEND_ARG_INFO(0, return) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_parameter___construct, 0) - ZEND_ARG_INFO(0, function) - ZEND_ARG_INFO(0, parameter) -ZEND_END_ARG_INFO() - static const zend_function_entry reflection_parameter_functions[] = { - ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) - ZEND_DEP_ME(reflection_parameter, export, arginfo_reflection_parameter_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) - ZEND_ME(reflection_parameter, __construct, arginfo_reflection_parameter___construct, 0) - ZEND_ME(reflection_parameter, __toString, arginfo_reflection__void, 0) - ZEND_ME(reflection_parameter, getName, arginfo_reflection__void, 0) - ZEND_ME(reflection_parameter, isPassedByReference, arginfo_reflection__void, 0) - ZEND_ME(reflection_parameter, canBePassedByValue, arginfo_reflection__void, 0) - ZEND_ME(reflection_parameter, getDeclaringFunction, arginfo_reflection__void, 0) - ZEND_ME(reflection_parameter, getDeclaringClass, arginfo_reflection__void, 0) - ZEND_ME(reflection_parameter, getClass, arginfo_reflection__void, 0) - ZEND_ME(reflection_parameter, hasType, arginfo_reflection__void, 0) - ZEND_ME(reflection_parameter, getType, arginfo_reflection__void, 0) - ZEND_ME(reflection_parameter, isArray, arginfo_reflection__void, 0) - ZEND_ME(reflection_parameter, isCallable, arginfo_reflection__void, 0) - ZEND_ME(reflection_parameter, allowsNull, arginfo_reflection__void, 0) - ZEND_ME(reflection_parameter, getPosition, arginfo_reflection__void, 0) - ZEND_ME(reflection_parameter, isOptional, arginfo_reflection__void, 0) - ZEND_ME(reflection_parameter, isDefaultValueAvailable, arginfo_reflection__void, 0) - ZEND_ME(reflection_parameter, getDefaultValue, arginfo_reflection__void, 0) - ZEND_ME(reflection_parameter, isDefaultValueConstant, arginfo_reflection__void, 0) - ZEND_ME(reflection_parameter, getDefaultValueConstantName, arginfo_reflection__void, 0) - ZEND_ME(reflection_parameter, isVariadic, arginfo_reflection__void, 0) + ZEND_ME(reflection, __clone, arginfo_class_ReflectionParameter___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) + ZEND_DEP_ME(reflection_parameter, export, arginfo_class_ReflectionParameter_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + ZEND_ME(reflection_parameter, __construct, arginfo_class_ReflectionParameter___construct, 0) + ZEND_ME(reflection_parameter, __toString, arginfo_class_ReflectionParameter___toString, 0) + ZEND_ME(reflection_parameter, getName, arginfo_class_ReflectionParameter_getName, 0) + ZEND_ME(reflection_parameter, isPassedByReference, arginfo_class_ReflectionParameter_isPassedByReference, 0) + ZEND_ME(reflection_parameter, canBePassedByValue, arginfo_class_ReflectionParameter_canBePassedByValue, 0) + ZEND_ME(reflection_parameter, getDeclaringFunction, arginfo_class_ReflectionParameter_getDeclaringFunction, 0) + ZEND_ME(reflection_parameter, getDeclaringClass, arginfo_class_ReflectionParameter_getDeclaringClass, 0) + ZEND_ME(reflection_parameter, getClass, arginfo_class_ReflectionParameter_getClass, 0) + ZEND_ME(reflection_parameter, hasType, arginfo_class_ReflectionParameter_hasType, 0) + ZEND_ME(reflection_parameter, getType, arginfo_class_ReflectionParameter_getType, 0) + ZEND_ME(reflection_parameter, isArray, arginfo_class_ReflectionParameter_isArray, 0) + ZEND_ME(reflection_parameter, isCallable, arginfo_class_ReflectionParameter_isCallable, 0) + ZEND_ME(reflection_parameter, allowsNull, arginfo_class_ReflectionParameter_allowsNull, 0) + ZEND_ME(reflection_parameter, getPosition, arginfo_class_ReflectionParameter_getPosition, 0) + ZEND_ME(reflection_parameter, isOptional, arginfo_class_ReflectionParameter_isOptional, 0) + ZEND_ME(reflection_parameter, isDefaultValueAvailable, arginfo_class_ReflectionParameter_isDefaultValueAvailable, 0) + ZEND_ME(reflection_parameter, getDefaultValue, arginfo_class_ReflectionParameter_getDefaultValue, 0) + ZEND_ME(reflection_parameter, isDefaultValueConstant, arginfo_class_ReflectionParameter_isDefaultValueConstant, 0) + ZEND_ME(reflection_parameter, getDefaultValueConstantName, arginfo_class_ReflectionParameter_getDefaultValueConstantName, 0) + ZEND_ME(reflection_parameter, isVariadic, arginfo_class_ReflectionParameter_isVariadic, 0) PHP_FE_END }; static const zend_function_entry reflection_type_functions[] = { - ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) - ZEND_ME(reflection_type, allowsNull, arginfo_reflection__void, 0) - ZEND_ME(reflection_type, isBuiltin, arginfo_reflection__void, 0) - ZEND_ME(reflection_type, __toString, arginfo_reflection__void, ZEND_ACC_DEPRECATED) + ZEND_ME(reflection, __clone, arginfo_class_ReflectionType___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) + ZEND_ME(reflection_type, allowsNull, arginfo_class_ReflectionType_allowsNull, 0) + ZEND_ME(reflection_type, __toString, arginfo_class_ReflectionType___toString, 0) PHP_FE_END }; static const zend_function_entry reflection_named_type_functions[] = { - ZEND_ME(reflection_named_type, getName, arginfo_reflection__void, 0) + ZEND_ME(reflection_named_type, getName, arginfo_class_ReflectionNamedType_getName, 0) + ZEND_ME(reflection_named_type, isBuiltin, arginfo_class_ReflectionNamedType_isBuiltin, 0) PHP_FE_END }; -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_extension_export, 0, 0, 1) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, return) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reflection_extension___construct, 0) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() +static const zend_function_entry reflection_union_type_functions[] = { + ZEND_ME(reflection_union_type, getTypes, arginfo_class_ReflectionUnionType_getTypes, 0) + PHP_FE_END +}; static const zend_function_entry reflection_extension_functions[] = { - ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) - ZEND_DEP_ME(reflection_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) - ZEND_ME(reflection_extension, __construct, arginfo_reflection_extension___construct, 0) - ZEND_ME(reflection_extension, __toString, arginfo_reflection__void, 0) - ZEND_ME(reflection_extension, getName, arginfo_reflection__void, 0) - ZEND_ME(reflection_extension, getVersion, arginfo_reflection__void, 0) - ZEND_ME(reflection_extension, getFunctions, arginfo_reflection__void, 0) - ZEND_ME(reflection_extension, getConstants, arginfo_reflection__void, 0) - ZEND_ME(reflection_extension, getINIEntries, arginfo_reflection__void, 0) - ZEND_ME(reflection_extension, getClasses, arginfo_reflection__void, 0) - ZEND_ME(reflection_extension, getClassNames, arginfo_reflection__void, 0) - ZEND_ME(reflection_extension, getDependencies, arginfo_reflection__void, 0) - ZEND_ME(reflection_extension, info, arginfo_reflection__void, 0) - ZEND_ME(reflection_extension, isPersistent, arginfo_reflection__void, 0) - ZEND_ME(reflection_extension, isTemporary, arginfo_reflection__void, 0) + ZEND_ME(reflection, __clone, arginfo_class_ReflectionExtension___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) + ZEND_DEP_ME(reflection_extension, export, arginfo_class_ReflectionExtension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + ZEND_ME(reflection_extension, __construct, arginfo_class_ReflectionExtension___construct, 0) + ZEND_ME(reflection_extension, __toString, arginfo_class_ReflectionExtension___toString, 0) + ZEND_ME(reflection_extension, getName, arginfo_class_ReflectionExtension_getName, 0) + ZEND_ME(reflection_extension, getVersion, arginfo_class_ReflectionExtension_getVersion, 0) + ZEND_ME(reflection_extension, getFunctions, arginfo_class_ReflectionExtension_getFunctions, 0) + ZEND_ME(reflection_extension, getConstants, arginfo_class_ReflectionExtension_getConstants, 0) + ZEND_ME(reflection_extension, getINIEntries, arginfo_class_ReflectionExtension_getINIEntries, 0) + ZEND_ME(reflection_extension, getClasses, arginfo_class_ReflectionExtension_getClasses, 0) + ZEND_ME(reflection_extension, getClassNames, arginfo_class_ReflectionExtension_getClassNames, 0) + ZEND_ME(reflection_extension, getDependencies, arginfo_class_ReflectionExtension_getDependencies, 0) + ZEND_ME(reflection_extension, info, arginfo_class_ReflectionExtension_info, 0) + ZEND_ME(reflection_extension, isPersistent, arginfo_class_ReflectionExtension_isPersistent, 0) + ZEND_ME(reflection_extension, isTemporary, arginfo_class_ReflectionExtension_isTemporary, 0) PHP_FE_END }; -ZEND_BEGIN_ARG_INFO(arginfo_reflection_zend_extension___construct, 0) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - static const zend_function_entry reflection_zend_extension_functions[] = { - ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) - ZEND_DEP_ME(reflection_zend_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) - ZEND_ME(reflection_zend_extension, __construct, arginfo_reflection_zend_extension___construct, 0) - ZEND_ME(reflection_zend_extension, __toString, arginfo_reflection__void, 0) - ZEND_ME(reflection_zend_extension, getName, arginfo_reflection__void, 0) - ZEND_ME(reflection_zend_extension, getVersion, arginfo_reflection__void, 0) - ZEND_ME(reflection_zend_extension, getAuthor, arginfo_reflection__void, 0) - ZEND_ME(reflection_zend_extension, getURL, arginfo_reflection__void, 0) - ZEND_ME(reflection_zend_extension, getCopyright, arginfo_reflection__void, 0) + ZEND_ME(reflection, __clone, arginfo_class_ReflectionZendExtension___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) + ZEND_DEP_ME(reflection_zend_extension, export, arginfo_class_ReflectionZendExtension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + ZEND_ME(reflection_zend_extension, __construct, arginfo_class_ReflectionZendExtension___construct, 0) + ZEND_ME(reflection_zend_extension, __toString, arginfo_class_ReflectionZendExtension___toString, 0) + ZEND_ME(reflection_zend_extension, getName, arginfo_class_ReflectionZendExtension_getName, 0) + ZEND_ME(reflection_zend_extension, getVersion, arginfo_class_ReflectionZendExtension_getVersion, 0) + ZEND_ME(reflection_zend_extension, getAuthor, arginfo_class_ReflectionZendExtension_getAuthor, 0) + ZEND_ME(reflection_zend_extension, getURL, arginfo_class_ReflectionZendExtension_getURL, 0) + ZEND_ME(reflection_zend_extension, getCopyright, arginfo_class_ReflectionZendExtension_getCopyright, 0) PHP_FE_END }; -ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_reference_fromArrayElement, 0, 0, 2) - ZEND_ARG_INFO(0, array) - ZEND_ARG_INFO(0, key) -ZEND_END_ARG_INFO() - static const zend_function_entry reflection_reference_functions[] = { - ZEND_ME(reflection_reference, fromArrayElement, arginfo_reflection_reference_fromArrayElement, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - ZEND_ME(reflection_reference, getId, arginfo_reflection__void, ZEND_ACC_PUBLIC) + ZEND_ME(reflection_reference, fromArrayElement, arginfo_class_ReflectionReference_fromArrayElement, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME(reflection_reference, getId, arginfo_class_ReflectionReference_getId, ZEND_ACC_PUBLIC) /* Always throwing dummy methods */ - ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE) - ZEND_ME(reflection_reference, __construct, arginfo_reflection__void, ZEND_ACC_PRIVATE) + ZEND_ME(reflection, __clone, arginfo_class_ReflectionReference___clone, ZEND_ACC_PRIVATE) + ZEND_ME(reflection_reference, __construct, arginfo_class_ReflectionReference___construct, ZEND_ACC_PRIVATE) PHP_FE_END }; /* }}} */ @@ -6741,20 +6601,19 @@ static const zend_function_entry reflection_ext_functions[] = { /* {{{ */ }; /* }}} */ /* {{{ _reflection_write_property */ -static zval *_reflection_write_property(zval *object, zval *member, zval *value, void **cache_slot) +static zval *_reflection_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot) { - if ((Z_TYPE_P(member) == IS_STRING) - && zend_hash_exists(&Z_OBJCE_P(object)->properties_info, Z_STR_P(member)) - && ((Z_STRLEN_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name"))) - || (Z_STRLEN_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class"))))) + if (zend_hash_exists(&object->ce->properties_info, name) + && ((ZSTR_LEN(name) == sizeof("name") - 1 && !memcmp(ZSTR_VAL(name), "name", sizeof("name"))) + || (ZSTR_LEN(name) == sizeof("class") - 1 && !memcmp(ZSTR_VAL(name), "class", sizeof("class"))))) { zend_throw_exception_ex(reflection_exception_ptr, 0, - "Cannot set read-only property %s::$%s", ZSTR_VAL(Z_OBJCE_P(object)->name), Z_STRVAL_P(member)); + "Cannot set read-only property %s::$%s", ZSTR_VAL(object->ce->name), ZSTR_VAL(name)); return &EG(uninitialized_zval); } else { - return zend_std_write_property(object, member, value, cache_slot); + return zend_std_write_property(object, name, value, cache_slot); } } /* }}} */ @@ -6811,11 +6670,16 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionType", reflection_type_functions); reflection_init_class_handlers(&_reflection_entry); reflection_type_ptr = zend_register_internal_class(&_reflection_entry); + reflection_type_ptr->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; INIT_CLASS_ENTRY(_reflection_entry, "ReflectionNamedType", reflection_named_type_functions); reflection_init_class_handlers(&_reflection_entry); reflection_named_type_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_type_ptr); + INIT_CLASS_ENTRY(_reflection_entry, "ReflectionUnionType", reflection_union_type_functions); + reflection_init_class_handlers(&_reflection_entry); + reflection_union_type_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_type_ptr); + INIT_CLASS_ENTRY(_reflection_entry, "ReflectionMethod", reflection_method_functions); reflection_init_class_handlers(&_reflection_entry); reflection_method_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_function_abstract_ptr); diff --git a/ext/reflection/php_reflection.h b/ext/reflection/php_reflection.h index b1d5717e3f..e4e08c16e6 100644 --- a/ext/reflection/php_reflection.h +++ b/ext/reflection/php_reflection.h @@ -1,7 +1,5 @@ /* +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | diff --git a/ext/reflection/reflection.stub.php b/ext/reflection/reflection.stub.php new file mode 100644 index 0000000000..11bb6c6433 --- /dev/null +++ b/ext/reflection/reflection.stub.php @@ -0,0 +1,642 @@ +<?php + +class ReflectionException extends Exception +{ +} + +class Reflection +{ + /** @return string[] */ + public static function getModifierNames(int $modifiers) {} + + public static function export(Reflector $reflector, bool $return = false) {} +} + +interface Reflector +{ + /** @return string */ + public function __toString(); +} + +abstract class ReflectionFunctionAbstract implements Reflector +{ + final private function __clone() {} + + /** @return bool */ + public function inNamespace() {} + + /** @return bool */ + public function isClosure() {} + + /** @return bool */ + public function isDeprecated() {} + + /** @return bool */ + public function isInternal() {} + + /** @return bool */ + public function isUserDefined() {} + + /** @return bool */ + public function isGenerator() {} + + /** @return bool */ + public function isVariadic() {} + + /** @return ?object */ + public function getClosureThis() {} + + /** @return ?ReflectionClass */ + public function getClosureScopeClass() {} + + /** @return string|false */ + public function getDocComment() {} + + /** @return int|false */ + public function getEndLine() {} + + /** @return ?ReflectionExtension */ + public function getExtension() {} + + /** @return string|false */ + public function getExtensionName() {} + + /** @return string|false */ + public function getFileName() {} + + /** @return string|false */ + public function getName() {} + + /** @return string|false */ + public function getNamespaceName() {} + + /** @return int */ + public function getNumberOfParameters() {} + + /** @return int */ + public function getNumberOfRequiredParameters() {} + + /** @return ReflectionParameter[] */ + public function getParameters() {} + + /** @return string|false */ + public function getShortName() {} + + /** @return int|false */ + public function getStartLine() {} + + /** @return array */ + public function getStaticVariables() {} + + /** @return bool */ + public function returnsReference() {} + + /** @return bool */ + public function hasReturnType() {} + + /** @return ?ReflectionType */ + public function getReturnType() {} +} + +class ReflectionFunction extends ReflectionFunctionAbstract +{ + /** @param string|Closure $name */ + public function __construct($name) {} + + /** @return string */ + public function __toString() {} + + public static function export($name, bool $return = false) {} + + /** @return bool */ + public function isDisabled() {} + + public function invoke(...$args) {} + + public function invokeArgs(array $args) {} + + /** @return Closure */ + public function getClosure() {} +} + +class ReflectionGenerator +{ + public function __construct(Generator $generator) {} + + /** @return int */ + public function getExecutingLine() {} + + /** @return string */ + public function getExecutingFile() {} + + /** @return array */ + public function getTrace(int $options = DEBUG_BACKTRACE_PROVIDE_OBJECT) {} + + /** @return ReflectionFunctionAbstract */ + public function getFunction() {} + + /** @return ?object */ + public function getThis() {} + + /** @return Generator */ + public function getExecutingGenerator() {} +} + +class ReflectionMethod extends ReflectionFunctionAbstract +{ + /** @param object|string $class_or_method */ + public function __construct($class_or_method, string $name = UNKNOWN) {} + + /** @return string */ + public function __toString() {} + + public static function export($class, $name, bool $return = false) {} + + /** @return bool */ + public function isPublic() {} + + /** @return bool */ + public function isPrivate() {} + + /** @return bool */ + public function isProtected() {} + + /** @return bool */ + public function isAbstract() {} + + /** @return bool */ + public function isFinal() {} + + /** @return bool */ + public function isStatic() {} + + /** @return bool */ + public function isConstructor() {} + + /** @return bool */ + public function isDestructor() {} + + /** @return Closure */ + public function getClosure($object = UNKNOWN) {} + + /** @return int */ + public function getModifiers() {} + + public function invoke(?object $object = null, ...$args) {} + + public function invokeArgs(?object $object, array $args) {} + + /** @return ReflectionClass */ + public function getDeclaringClass() {} + + /** @return ReflectionMethod */ + public function getPrototype() {} + + /** @return void */ + public function setAccessible(bool $visible) {} +} + +class ReflectionClass implements Reflector +{ + final private function __clone() {} + + public static function export($argument, bool $return = false) {} + + /** @param object|string $argument */ + public function __construct($argument) {} + + /** @return string */ + public function __toString() {} + + /** @return string|false */ + public function getName() {} + + /** @return bool */ + public function isInternal() {} + + /** @return bool */ + public function isUserDefined() {} + + /** @return bool */ + public function isAnonymous() {} + + /** @return bool */ + public function isInstantiable() {} + + /** @return bool */ + public function isCloneable() {} + + /** @return string|false */ + public function getFileName() {} + + /** @return int|false */ + public function getStartLine() {} + + /** @return int|false */ + public function getEndLine() {} + + /** @return string|false */ + public function getDocComment() {} + + /** @return ?ReflectionMethod */ + public function getConstructor() {} + + /** @return bool */ + public function hasMethod(string $name) {} + + /** @return ReflectionMethod */ + public function getMethod(string $name) {} + + /** @return ReflectionMethod[] */ + public function getMethods(?int $filter = null) {} + + /** @return bool */ + public function hasProperty(string $name) {} + + /** @return ReflectionProperty */ + public function getProperty(string $name) {} + + /** @return ReflectionProperty[] */ + public function getProperties(?int $filter = null) {} + + /** @return bool */ + public function hasConstant(string $name) {} + + /** @return ?array */ + public function getConstants() {} + + /** @return ReflectionClassConstant[] */ + public function getReflectionConstants() {} + + public function getConstant(string $name) {} + + /** @return ReflectionClassConstant|false */ + public function getReflectionConstant(string $name) {} + + /** @return ReflectionClass[] */ + public function getInterfaces() {} + + /** @return string[] */ + public function getInterfaceNames() {} + + /** @return bool */ + public function isInterface() {} + + /** @return ReflectionClass[] */ + public function getTraits() {} + + /** @return string[] */ + public function getTraitNames() {} + + /** @return string[] */ + public function getTraitAliases() {} + + /** @return bool */ + public function isTrait() {} + + /** @return bool */ + public function isAbstract() {} + + /** @return bool */ + public function isFinal() {} + + /** @return int */ + public function getModifiers() {} + + /** @return bool */ + public function isIntance(object $object) {} + + /** @return object */ + public function newInstance(...$args) {} + + /** @return object */ + public function newInstanceWithoutConstructor() {} + + /** @return object */ + public function newInstanceArgs(array $args = []) {} + + /** @return ReflectionClass|false */ + public function getParentClass() {} + + /** + * @param string|ReflectionClass $class + * @return bool + */ + public function isSubclassOf($class) {} + + /** @return ?array */ + public function getStaticProperties() {} + + public function getStaticPropertyValue(string $name, $default = UNKNOWN) {} + + /** @return void */ + public function setStaticPropertyValue(string $name, $value) {} + + /** @return array */ + public function getDefaultProperties() {} + + /** @return bool */ + public function isIterable() {} + + /** @return bool */ + public function isIterateable() {} + + /** + * @param string|ReflectionClass $interface + * @return bool + */ + public function implementsInterface($interface) {} + + /** @return ?ReflectionExtension */ + public function getExtension() {} + + /** @return string|false */ + public function getExtensionName() {} + + /** @return bool */ + public function inNamespace() {} + + /** @return string|false */ + public function getNamespaceName() {} + + /** @return string|false */ + public function getShortName() {} +} + +class ReflectionObject extends ReflectionClass +{ + public function __construct(object $argument) {} + + public static function export($argument, bool $return = false) {} +} + +class ReflectionProperty implements Reflector +{ + final private function __clone() {} + + public static function export($class, $name, bool $return = false) {} + + /** @param string|object $class */ + public function __construct($class, string $name) {} + + /** @return string */ + public function __toString() {} + + /** @return string|false */ + public function getName() {} + + public function getValue(?object $object = null) {} + + /** @return void */ + public function setValue($object_or_value, $value = UNKNOWN) {} + + /** @return bool */ + public function isInitialized(object $object = UNKNOWN) {} + + /** @return bool */ + public function isPublic() {} + + /** @return bool */ + public function isPrivate() {} + + /** @return bool */ + public function isProtected() {} + + /** @return bool */ + public function isStatic() {} + + /** @return bool */ + public function isDefault() {} + + /** @return int */ + public function getModifiers() {} + + /** @return ReflectionClass */ + public function getDeclaringClass() {} + + /** @return string|false */ + public function getDocComment() {} + + /** @return void */ + public function setAccessible(bool $visible) {} + + /** @return ?ReflectionType */ + public function getType() {} + + /** @return bool */ + public function hasType() {} +} + +class ReflectionClassConstant implements Reflector +{ + final private function __clone() {} + + public static function export($class, $name, bool $return = false) {} + + /** @return string|object */ + public function __construct($class, string $name) {} + + /** @return string */ + public function __toString() {} + + /** @return string|false */ + public function getName() {} + + public function getValue() {} + + /** @return bool */ + public function isPublic() {} + + /** @return bool */ + public function isPrivate() {} + + /** @return bool */ + public function isProtected() {} + + /** @return int */ + public function getModifiers() {} + + /** @return ReflectionClass */ + public function getDeclaringClass() {} + + /** @return string|false */ + public function getDocComment() {} +} + +class ReflectionParameter implements Reflector +{ + final private function __clone() {} + + public static function export($function, $parameter, bool $return = false) {} + + /** + * @param string|array|object + * @param int|string + */ + public function __construct($function, $parameter) {} + + /** @return string */ + public function __toString() {} + + /** @return string|false */ + public function getName() {} + + /** @return bool */ + public function isPassedByReference() {} + + /** @return bool */ + public function canBePassedByValue() {} + + /** @return ReflectionFunctionAbstract */ + public function getDeclaringFunction() {} + + /** @return ?ReflectionClass */ + public function getDeclaringClass() {} + + /** @return ?ReflectionClass */ + public function getClass() {} + + /** @return bool */ + public function hasType() {} + + /** @return ?ReflectionType */ + public function getType() {} + + /** @return bool */ + public function isArray() {} + + /** @return bool */ + public function isCallable() {} + + /** @return bool */ + public function allowsNull() {} + + /** @return int */ + public function getPosition() {} + + /** @return bool */ + public function isOptional() {} + + /** @return bool */ + public function isDefaultValueAvailable() {} + + public function getDefaultValue() {} + + /** @return bool */ + public function isDefaultValueConstant() {} + + /** @return ?string */ + public function getDefaultValueConstantName() {} + + /** @return bool */ + public function isVariadic() {} +} + +abstract class ReflectionType +{ + final private function __clone() {} + + /** @return bool */ + public function allowsNull() {} + + /** @return string */ + public function __toString() {} +} + +class ReflectionNamedType extends ReflectionType +{ + /** @return string */ + public function getName() {} + + /** @return bool */ + public function isBuiltin() {} +} + +class ReflectionUnionType extends ReflectionType +{ + public function getTypes(): array {} +} + +class ReflectionExtension implements Reflector +{ + final private function __clone() {} + + public static function export($name, bool $return = false) {} + + public function __construct(string $name) {} + + /** @return string */ + public function __toString() {} + + /** @return string|false */ + public function getName() {} + + /** @return ?string */ + public function getVersion() {} + + /** @return ReflectionFunction[] */ + public function getFunctions() {} + + /** @return array */ + public function getConstants() {} + + /** @return array */ + public function getINIEntries() {} + + /** @return ReflectionClass[] */ + public function getClasses() {} + + /** @return string[] */ + public function getClassNames() {} + + /** @return array */ + public function getDependencies() {} + + /** @return void */ + public function info() {} + + /** @return bool */ + public function isPersistent() {} + + /** @return bool */ + public function isTemporary() {} +} + +class ReflectionZendExtension implements Reflector +{ + final private function __clone() {} + + public static function export($name, bool $return = false) {} + + public function __construct(string $name) {} + + /** @return string */ + public function __toString() {} + + /** @return string */ + public function getName() {} + + /** @return string */ + public function getVersion() {} + + /** @return string */ + public function getAuthor() {} + + /** @return string */ + public function getURL() {} + + /** @return string */ + public function getCopyright() {} +} + +final class ReflectionReference +{ + /** @param int|string $key */ + public static function fromArrayElement(array $array, $key): ?ReflectionReference {} + + public function getId(): string {} + + private function __clone() {} + + private function __construct() {} +} diff --git a/ext/reflection/reflection_arginfo.h b/ext/reflection/reflection_arginfo.h new file mode 100644 index 0000000000..078a793c9b --- /dev/null +++ b/ext/reflection/reflection_arginfo.h @@ -0,0 +1,492 @@ +/* This is a generated file, edit the .stub.php file instead. */ + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Reflection_getModifierNames, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, modifiers, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Reflection_export, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, reflector, Reflector, 0) + ZEND_ARG_TYPE_INFO(0, return, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Reflector___toString, 0, 0, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionFunctionAbstract___clone arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_inNamespace arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_isClosure arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_isDeprecated arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_isInternal arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_isUserDefined arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_isGenerator arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_isVariadic arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_getClosureThis arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_getClosureScopeClass arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_getDocComment arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_getEndLine arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_getExtension arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_getExtensionName arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_getFileName arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_getName arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_getNamespaceName arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_getNumberOfParameters arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_getNumberOfRequiredParameters arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_getParameters arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_getShortName arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_getStartLine arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_getStaticVariables arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_returnsReference arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_hasReturnType arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionFunctionAbstract_getReturnType arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionFunction___construct, 0, 0, 1) + ZEND_ARG_INFO(0, name) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionFunction___toString arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionFunction_export, 0, 0, 1) + ZEND_ARG_INFO(0, name) + ZEND_ARG_TYPE_INFO(0, return, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionFunction_isDisabled arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionFunction_invoke, 0, 0, 0) + ZEND_ARG_VARIADIC_INFO(0, args) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionFunction_invokeArgs, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionFunction_getClosure arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionGenerator___construct, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, generator, Generator, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionGenerator_getExecutingLine arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionGenerator_getExecutingFile arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionGenerator_getTrace, 0, 0, 0) + ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionGenerator_getFunction arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionGenerator_getThis arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionGenerator_getExecutingGenerator arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod___construct, 0, 0, 1) + ZEND_ARG_INFO(0, class_or_method) + ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionMethod___toString arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod_export, 0, 0, 2) + ZEND_ARG_INFO(0, class) + ZEND_ARG_INFO(0, name) + ZEND_ARG_TYPE_INFO(0, return, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionMethod_isPublic arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionMethod_isPrivate arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionMethod_isProtected arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionMethod_isAbstract arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionMethod_isFinal arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionMethod_isStatic arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionMethod_isConstructor arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionMethod_isDestructor arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod_getClosure, 0, 0, 0) + ZEND_ARG_INFO(0, object) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionMethod_getModifiers arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod_invoke, 0, 0, 0) + ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 1) + ZEND_ARG_VARIADIC_INFO(0, args) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod_invokeArgs, 0, 0, 2) + ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 1) + ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionMethod_getDeclaringClass arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionMethod_getPrototype arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod_setAccessible, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, visible, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionClass___clone arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_export, 0, 0, 1) + ZEND_ARG_INFO(0, argument) + ZEND_ARG_TYPE_INFO(0, return, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass___construct, 0, 0, 1) + ZEND_ARG_INFO(0, argument) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionClass___toString arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_getName arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_isInternal arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_isUserDefined arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_isAnonymous arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_isInstantiable arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_isCloneable arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_getFileName arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_getStartLine arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_getEndLine arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_getDocComment arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_getConstructor arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_hasMethod, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionClass_getMethod arginfo_class_ReflectionClass_hasMethod + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_getMethods, 0, 0, 0) + ZEND_ARG_TYPE_INFO(0, filter, IS_LONG, 1) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionClass_hasProperty arginfo_class_ReflectionClass_hasMethod + +#define arginfo_class_ReflectionClass_getProperty arginfo_class_ReflectionClass_hasMethod + +#define arginfo_class_ReflectionClass_getProperties arginfo_class_ReflectionClass_getMethods + +#define arginfo_class_ReflectionClass_hasConstant arginfo_class_ReflectionClass_hasMethod + +#define arginfo_class_ReflectionClass_getConstants arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_getReflectionConstants arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_getConstant arginfo_class_ReflectionClass_hasMethod + +#define arginfo_class_ReflectionClass_getReflectionConstant arginfo_class_ReflectionClass_hasMethod + +#define arginfo_class_ReflectionClass_getInterfaces arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_getInterfaceNames arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_isInterface arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_getTraits arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_getTraitNames arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_getTraitAliases arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_isTrait arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_isAbstract arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_isFinal arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_getModifiers arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_isIntance, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionClass_newInstance arginfo_class_ReflectionFunction_invoke + +#define arginfo_class_ReflectionClass_newInstanceWithoutConstructor arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_newInstanceArgs, 0, 0, 0) + ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionClass_getParentClass arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_isSubclassOf, 0, 0, 1) + ZEND_ARG_INFO(0, class) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionClass_getStaticProperties arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_getStaticPropertyValue, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) + ZEND_ARG_INFO(0, default) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_setStaticPropertyValue, 0, 0, 2) + ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionClass_getDefaultProperties arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_isIterable arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_isIterateable arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_implementsInterface, 0, 0, 1) + ZEND_ARG_INFO(0, interface) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionClass_getExtension arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_getExtensionName arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_inNamespace arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_getNamespaceName arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClass_getShortName arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionObject___construct, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, argument, IS_OBJECT, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionObject_export arginfo_class_ReflectionClass_export + +#define arginfo_class_ReflectionProperty___clone arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionProperty_export arginfo_class_ReflectionMethod_export + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionProperty___construct, 0, 0, 2) + ZEND_ARG_INFO(0, class) + ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionProperty___toString arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionProperty_getName arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionProperty_getValue, 0, 0, 0) + ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 1) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionProperty_setValue, 0, 0, 1) + ZEND_ARG_INFO(0, object_or_value) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionProperty_isInitialized, 0, 0, 0) + ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionProperty_isPublic arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionProperty_isPrivate arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionProperty_isProtected arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionProperty_isStatic arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionProperty_isDefault arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionProperty_getModifiers arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionProperty_getDeclaringClass arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionProperty_getDocComment arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionProperty_setAccessible arginfo_class_ReflectionMethod_setAccessible + +#define arginfo_class_ReflectionProperty_getType arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionProperty_hasType arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClassConstant___clone arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClassConstant_export arginfo_class_ReflectionMethod_export + +#define arginfo_class_ReflectionClassConstant___construct arginfo_class_ReflectionProperty___construct + +#define arginfo_class_ReflectionClassConstant___toString arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClassConstant_getName arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClassConstant_getValue arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClassConstant_isPublic arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClassConstant_isPrivate arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClassConstant_isProtected arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClassConstant_getModifiers arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClassConstant_getDeclaringClass arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionClassConstant_getDocComment arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionParameter___clone arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionParameter_export, 0, 0, 2) + ZEND_ARG_INFO(0, function) + ZEND_ARG_INFO(0, parameter) + ZEND_ARG_TYPE_INFO(0, return, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionParameter___construct, 0, 0, 2) + ZEND_ARG_INFO(0, function) + ZEND_ARG_INFO(0, parameter) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionParameter___toString arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionParameter_getName arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionParameter_isPassedByReference arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionParameter_canBePassedByValue arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionParameter_getDeclaringFunction arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionParameter_getDeclaringClass arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionParameter_getClass arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionParameter_hasType arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionParameter_getType arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionParameter_isArray arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionParameter_isCallable arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionParameter_allowsNull arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionParameter_getPosition arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionParameter_isOptional arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionParameter_isDefaultValueAvailable arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionParameter_getDefaultValue arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionParameter_isDefaultValueConstant arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionParameter_getDefaultValueConstantName arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionParameter_isVariadic arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionType___clone arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionType_allowsNull arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionType___toString arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionNamedType_getName arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionNamedType_isBuiltin arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ReflectionUnionType_getTypes, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionExtension___clone arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionExtension_export arginfo_class_ReflectionFunction_export + +#define arginfo_class_ReflectionExtension___construct arginfo_class_ReflectionClass_hasMethod + +#define arginfo_class_ReflectionExtension___toString arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionExtension_getName arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionExtension_getVersion arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionExtension_getFunctions arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionExtension_getConstants arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionExtension_getINIEntries arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionExtension_getClasses arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionExtension_getClassNames arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionExtension_getDependencies arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionExtension_info arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionExtension_isPersistent arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionExtension_isTemporary arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionZendExtension___clone arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionZendExtension_export arginfo_class_ReflectionFunction_export + +#define arginfo_class_ReflectionZendExtension___construct arginfo_class_ReflectionClass_hasMethod + +#define arginfo_class_ReflectionZendExtension___toString arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionZendExtension_getName arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionZendExtension_getVersion arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionZendExtension_getAuthor arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionZendExtension_getURL arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionZendExtension_getCopyright arginfo_class_Reflector___toString + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_ReflectionReference_fromArrayElement, 0, 2, ReflectionReference, 1) + ZEND_ARG_TYPE_INFO(0, array, IS_ARRAY, 0) + ZEND_ARG_INFO(0, key) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ReflectionReference_getId, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_ReflectionReference___clone arginfo_class_Reflector___toString + +#define arginfo_class_ReflectionReference___construct arginfo_class_Reflector___toString diff --git a/ext/reflection/tests/001.phpt b/ext/reflection/tests/001.phpt index f68afc950e..266a1ef5ff 100644 --- a/ext/reflection/tests/001.phpt +++ b/ext/reflection/tests/001.phpt @@ -75,7 +75,6 @@ sort($props); var_dump($props); var_dump($r->name); ?> -===DONE=== --EXPECT-- array(0) { } @@ -86,4 +85,3 @@ array(2) { string(4) "name" } string(17) "ReflectionClassEx" -===DONE=== diff --git a/ext/reflection/tests/002.phpt b/ext/reflection/tests/002.phpt index d0fcb32bea..6df97f0daa 100644 --- a/ext/reflection/tests/002.phpt +++ b/ext/reflection/tests/002.phpt @@ -47,7 +47,6 @@ var_dump($r->foo); var_dump($r->bar); ?> -===DONE=== --EXPECT-- ReflectionMethodEx::__construct string(26) "ReflectionFunctionAbstract" @@ -60,4 +59,3 @@ string(26) "ReflectionFunctionAbstract" string(7) "getName" string(3) "bar" string(3) "baz" -===DONE=== diff --git a/ext/reflection/tests/003.phpt b/ext/reflection/tests/003.phpt index 80bf0a6513..8c37d539ac 100644 --- a/ext/reflection/tests/003.phpt +++ b/ext/reflection/tests/003.phpt @@ -25,7 +25,5 @@ $r = new ReflectionMethod('Foo','Test'); $r->invoke($o); ?> -===DONE=== --EXPECT-- Foo::Test -===DONE=== diff --git a/ext/reflection/tests/004.phpt b/ext/reflection/tests/004.phpt index 36ae406b43..924c3fe283 100644 --- a/ext/reflection/tests/004.phpt +++ b/ext/reflection/tests/004.phpt @@ -4,7 +4,7 @@ ReflectionMethod::invoke() with non object or null value <?php class a { - function a(){ + function __construct(){ } } class b { @@ -13,7 +13,7 @@ class b { $b = new b(); $a=new ReflectionClass("a"); -$m=$a->getMethod("a"); +$m=$a->getMethod("__construct"); try { $m->invoke(null); @@ -35,9 +35,7 @@ try { echo $E->getMessage()."\n"; } -echo "===DONE===\n";?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; a has a deprecated constructor in %s on line %d -Trying to invoke non static method a::a() without an object +?> +--EXPECT-- +Trying to invoke non static method a::__construct() without an object Given object is not an instance of the class this method was declared in -===DONE=== diff --git a/ext/reflection/tests/005.phpt b/ext/reflection/tests/005.phpt index e40fcc3099..cb099129e7 100644 --- a/ext/reflection/tests/005.phpt +++ b/ext/reflection/tests/005.phpt @@ -46,11 +46,9 @@ foreach($r->getMethods() as $m) } ?> -===DONE=== --EXPECT-- string(19) "Comment for class A" string(15) "Method A::bla()" bool(false) bool(false) string(22) "* Comment for A::baz()" -===DONE=== diff --git a/ext/reflection/tests/006.phpt b/ext/reflection/tests/006.phpt index ab22f5c5c9..28d4cc592b 100644 --- a/ext/reflection/tests/006.phpt +++ b/ext/reflection/tests/006.phpt @@ -82,8 +82,6 @@ Test::testing(); TestDerived::testing(); ?> -===DONE=== -<?php exit(0); ?> --EXPECT-- string(3) "pub" string(3) "pub" @@ -100,4 +98,3 @@ string(7) "updated" string(7) "updated" EXCEPTION EXCEPTION -===DONE=== diff --git a/ext/reflection/tests/007.phpt b/ext/reflection/tests/007.phpt index 8babf24282..57e3ee47fe 100644 --- a/ext/reflection/tests/007.phpt +++ b/ext/reflection/tests/007.phpt @@ -88,8 +88,6 @@ Class WithCtorWithArgs test('WithCtorWithArgs'); ?> -===DONE=== -<?php exit(0); ?> --EXPECTF-- ====>Class_does_not_exist {closure}(Class_does_not_exist) @@ -151,4 +149,3 @@ array(2) { object(WithCtorWithArgs)#%d (0) { } -===DONE=== diff --git a/ext/reflection/tests/010.phpt b/ext/reflection/tests/010.phpt index 8345dc35bf..ae667b65ab 100644 --- a/ext/reflection/tests/010.phpt +++ b/ext/reflection/tests/010.phpt @@ -1,5 +1,5 @@ --TEST-- -ReflectionMethod::__toString() tests (overriden method) +ReflectionMethod::__toString() tests (overridden method) --FILE-- <?php class Foo { diff --git a/ext/reflection/tests/ReflectionClass_constructor_002.phpt b/ext/reflection/tests/ReflectionClass_constructor_002.phpt index c463bb72c1..7d8a312f51 100644 --- a/ext/reflection/tests/ReflectionClass_constructor_002.phpt +++ b/ext/reflection/tests/ReflectionClass_constructor_002.phpt @@ -4,7 +4,7 @@ ReflectionClass::__constructor() - bad arguments <?php try { var_dump(new ReflectionClass()); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } @@ -34,7 +34,7 @@ try { try { var_dump(new ReflectionClass("stdClass", 1)); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } @@ -46,21 +46,12 @@ try { ?> --EXPECTF-- -Warning: ReflectionClass::__construct() expects exactly 1 parameter, 0 given in %s on line 3 -object(ReflectionClass)#%d (1) { - ["name"]=> - string(0) "" -} +ReflectionClass::__construct() expects exactly 1 parameter, 0 given Class does not exist Class 1 does not exist Class 1 does not exist -Notice: Array to string conversion in %s on line 27 +Warning: Array to string conversion in %s on line %d Class Array does not exist - -Warning: ReflectionClass::__construct() expects exactly 1 parameter, 2 given in %s on line 33 -object(ReflectionClass)#%d (1) { - ["name"]=> - string(0) "" -} +ReflectionClass::__construct() expects exactly 1 parameter, 2 given Class X does not exist diff --git a/ext/reflection/tests/ReflectionClass_export_basic1.phpt b/ext/reflection/tests/ReflectionClass_export_basic1.phpt index d9183442c4..784fc6a5fb 100644 --- a/ext/reflection/tests/ReflectionClass_export_basic1.phpt +++ b/ext/reflection/tests/ReflectionClass_export_basic1.phpt @@ -50,12 +50,12 @@ Class [ <user> class C extends A ] { - Parameters [8] { Parameter #0 [ <required> A $a ] Parameter #1 [ <required> $b ] - Parameter #2 [ <optional> C or NULL $c = NULL ] + Parameter #2 [ <optional> ?C $c = NULL ] Parameter #3 [ <optional> $d = '16 chars long -...' ] Parameter #4 [ <optional> $e = '15 chars long -' ] Parameter #5 [ <optional> $f = NULL ] Parameter #6 [ <optional> $g = false ] - Parameter #7 [ <optional> array or NULL $h = NULL ] + Parameter #7 [ <optional> ?array $h = NULL ] } } } diff --git a/ext/reflection/tests/ReflectionClass_getConstant_basic.phpt b/ext/reflection/tests/ReflectionClass_getConstant_basic.phpt index cbed1252fa..59031a26ee 100644 --- a/ext/reflection/tests/ReflectionClass_getConstant_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_getConstant_basic.phpt @@ -20,7 +20,7 @@ foreach($classes as $class) { echo "Reflecting on class $class: \n"; $rc = new ReflectionClass($class); var_dump($rc->getConstant('a')); - var_dump($rc->getConstant('doesntexist')); + var_dump($rc->getConstant('doesnotexist')); } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionClass_getConstant_error.phpt b/ext/reflection/tests/ReflectionClass_getConstant_error.phpt index 5260e719a3..020ac6f7f5 100644 --- a/ext/reflection/tests/ReflectionClass_getConstant_error.phpt +++ b/ext/reflection/tests/ReflectionClass_getConstant_error.phpt @@ -8,30 +8,14 @@ class C { $rc = new ReflectionClass("C"); echo "Check invalid params:\n"; -var_dump($rc->getConstant()); -var_dump($rc->getConstant("myConst", "myConst")); var_dump($rc->getConstant(null)); var_dump($rc->getConstant(1)); var_dump($rc->getConstant(1.5)); var_dump($rc->getConstant(true)); -var_dump($rc->getConstant(array(1,2,3))); -var_dump($rc->getConstant(new C)); ?> ---EXPECTF-- +--EXPECT-- Check invalid params: - -Warning: ReflectionClass::getConstant() expects exactly 1 parameter, 0 given in %s on line 8 -NULL - -Warning: ReflectionClass::getConstant() expects exactly 1 parameter, 2 given in %s on line 9 -NULL bool(false) bool(false) bool(false) bool(false) - -Warning: ReflectionClass::getConstant() expects parameter 1 to be string, array given in %s on line 14 -NULL - -Warning: ReflectionClass::getConstant() expects parameter 1 to be string, object given in %s on line 15 -NULL diff --git a/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt b/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt index 5db9d8f3d3..df6880aedb 100644 --- a/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt @@ -9,48 +9,7 @@ class NewCtor { class ExtendsNewCtor extends NewCtor { } -class OldCtor { - function OldCtor() {} -} - -class ExtendsOldCtor extends OldCtor { -} - - -class X { - function Y() {} -} - -class Y extends X { -} - -class OldAndNewCtor { - function OldAndNewCtor() {} - function __construct() {} -} - -class NewAndOldCtor { - function __construct() {} - function NewAndOldCtor() {} -} -class B { - function B() {} -} - -class C extends B { - function C() {} -} - -class D1 extends C { - function __construct() {} -} - -class D2 extends C { -} - -$classes = array('NewCtor', 'ExtendsNewCtor', 'OldCtor', 'ExtendsOldCtor', - 'OldAndNewCtor', 'NewAndOldCtor', 'B', 'C', 'D1', 'D2', 'X', 'Y'); - +$classes = array('NewCtor', 'ExtendsNewCtor'); foreach ($classes as $class) { $rc = new ReflectionClass($class); $rm = $rc->getConstructor(); @@ -63,21 +22,6 @@ foreach ($classes as $class) { } ?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OldCtor has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; C has a deprecated constructor in %s on line %d +--EXPECT-- Constructor of NewCtor: __construct Constructor of ExtendsNewCtor: __construct -Constructor of OldCtor: OldCtor -Constructor of ExtendsOldCtor: OldCtor -Constructor of OldAndNewCtor: __construct -Constructor of NewAndOldCtor: __construct -Constructor of B: B -Constructor of C: C -Constructor of D1: __construct -Constructor of D2: C -No constructor for X -No constructor for Y diff --git a/ext/reflection/tests/ReflectionClass_getMethod_001.phpt b/ext/reflection/tests/ReflectionClass_getMethod_001.phpt index 59887991ec..e2a4eb9903 100644 --- a/ext/reflection/tests/ReflectionClass_getMethod_001.phpt +++ b/ext/reflection/tests/ReflectionClass_getMethod_001.phpt @@ -37,9 +37,9 @@ foreach($classes as $class) { var_dump($rc->getMethod("s")); echo " --> Check for F(): "; var_dump($rc->getMethod("F")); - echo " --> Check for doesntExist(): "; + echo " --> Check for doesNotExist(): "; try { - var_dump($rc->getMethod("doesntExist")); + var_dump($rc->getMethod("doesNotExist")); } catch (Exception $e) { echo $e->getMessage() . "\n"; } @@ -65,7 +65,7 @@ Reflecting on class pubf: ["class"]=> string(4) "pubf" } - --> Check for doesntExist(): Method doesntExist does not exist + --> Check for doesNotExist(): Method doesNotExist does not exist Reflecting on class subpubf: --> Check for f(): object(ReflectionMethod)#%d (2) { ["name"]=> @@ -85,7 +85,7 @@ Reflecting on class subpubf: ["class"]=> string(4) "pubf" } - --> Check for doesntExist(): Method doesntExist does not exist + --> Check for doesNotExist(): Method doesNotExist does not exist Reflecting on class protf: --> Check for f(): object(ReflectionMethod)#%d (2) { ["name"]=> @@ -105,7 +105,7 @@ Reflecting on class protf: ["class"]=> string(5) "protf" } - --> Check for doesntExist(): Method doesntExist does not exist + --> Check for doesNotExist(): Method doesNotExist does not exist Reflecting on class subprotf: --> Check for f(): object(ReflectionMethod)#%d (2) { ["name"]=> @@ -125,7 +125,7 @@ Reflecting on class subprotf: ["class"]=> string(5) "protf" } - --> Check for doesntExist(): Method doesntExist does not exist + --> Check for doesNotExist(): Method doesNotExist does not exist Reflecting on class privf: --> Check for f(): object(ReflectionMethod)#%d (2) { ["name"]=> @@ -145,7 +145,7 @@ Reflecting on class privf: ["class"]=> string(5) "privf" } - --> Check for doesntExist(): Method doesntExist does not exist + --> Check for doesNotExist(): Method doesNotExist does not exist Reflecting on class subprivf: --> Check for f(): object(ReflectionMethod)#%d (2) { ["name"]=> @@ -165,4 +165,4 @@ Reflecting on class subprivf: ["class"]=> string(5) "privf" } - --> Check for doesntExist(): Method doesntExist does not exist + --> Check for doesNotExist(): Method doesNotExist does not exist diff --git a/ext/reflection/tests/ReflectionClass_getMethod_002.phpt b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt index 1eb084214b..424550f67a 100644 --- a/ext/reflection/tests/ReflectionClass_getMethod_002.phpt +++ b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt @@ -13,12 +13,12 @@ $rc = new ReflectionClass("C"); echo "Check invalid params:\n"; try { var_dump($rc->getMethod()); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($rc->getMethod("f", "f")); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { @@ -43,32 +43,24 @@ try { } try { var_dump($rc->getMethod(array(1,2,3))); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($rc->getMethod(new C)); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } ?> ---EXPECTF-- +--EXPECT-- Check invalid params: - -Warning: ReflectionClass::getMethod() expects exactly 1 parameter, 0 given in %s on line 9 -NULL - -Warning: ReflectionClass::getMethod() expects exactly 1 parameter, 2 given in %s on line 14 -NULL +ReflectionClass::getMethod() expects exactly 1 parameter, 0 given +ReflectionClass::getMethod() expects exactly 1 parameter, 2 given Method does not exist Method 1 does not exist Method 1.5 does not exist Method 1 does not exist - -Warning: ReflectionClass::getMethod() expects parameter 1 to be string, array given in %s on line 39 -NULL - -Warning: ReflectionClass::getMethod() expects parameter 1 to be string, object given in %s on line 44 -NULL +ReflectionClass::getMethod() expects parameter 1 to be string, array given +ReflectionClass::getMethod() expects parameter 1 to be string, object given diff --git a/ext/reflection/tests/ReflectionClass_getModifierNames_basic.phpt b/ext/reflection/tests/ReflectionClass_getModifierNames_basic.phpt index 91a0a18f1a..ba7fa6880b 100644 --- a/ext/reflection/tests/ReflectionClass_getModifierNames_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_getModifierNames_basic.phpt @@ -49,7 +49,6 @@ dump_methodModifierNames('x'); dump_methodModifierNames('y'); ?> -==DONE== --EXPECT-- string(1) "a" array(0) { @@ -136,4 +135,3 @@ array(2) { [1]=> string(9) "protected" } -==DONE== diff --git a/ext/reflection/tests/ReflectionClass_getParentClass.phpt b/ext/reflection/tests/ReflectionClass_getParentClass.phpt index 382948d3d3..ef64de5ecb 100644 --- a/ext/reflection/tests/ReflectionClass_getParentClass.phpt +++ b/ext/reflection/tests/ReflectionClass_getParentClass.phpt @@ -10,11 +10,14 @@ class Foo {} class Bar extends Foo {} -$rc1 = new ReflectionClass("Bar"); -var_dump($rc1->getParentClass()); +$rc = new ReflectionClass("Bar"); +$parent = $rc->getParentClass(); +$grandParent = $parent->getParentClass(); +var_dump($parent, $grandParent); ?> --EXPECTF-- object(ReflectionClass)#%d (1) { ["name"]=> string(3) "Foo" } +bool(false) diff --git a/ext/reflection/tests/ReflectionClass_getParentClass_001.phpt b/ext/reflection/tests/ReflectionClass_getParentClass_001.phpt deleted file mode 100644 index be50dbb730..0000000000 --- a/ext/reflection/tests/ReflectionClass_getParentClass_001.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -ReflectionClass::getParentClass() ---CREDITS-- -Robin Fernandes <robinf@php.net> -Steve Seear <stevseea@php.net> ---FILE-- -<?php -class A {} -class B extends A {} - -$rc = new ReflectionClass('B'); -$parent = $rc->getParentClass(); -$grandParent = $parent->getParentClass(); -var_dump($parent, $grandParent); - -echo "\nTest bad params:\n"; -var_dump($rc->getParentClass(null)); -var_dump($rc->getParentClass('x')); -var_dump($rc->getParentClass('x', 123)); - -?> ---EXPECTF-- -object(ReflectionClass)#%d (1) { - ["name"]=> - string(1) "A" -} -bool(false) - -Test bad params: - -Warning: ReflectionClass::getParentClass() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionClass::getParentClass() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionClass::getParentClass() expects exactly 0 parameters, 2 given in %s on line %d -NULL diff --git a/ext/reflection/tests/ReflectionClass_getProperty_001.phpt b/ext/reflection/tests/ReflectionClass_getProperty_001.phpt index 830608e0ca..b69d51eb00 100644 --- a/ext/reflection/tests/ReflectionClass_getProperty_001.phpt +++ b/ext/reflection/tests/ReflectionClass_getProperty_001.phpt @@ -50,8 +50,8 @@ foreach($classes as $class) { echo $e->getMessage() . "\n"; } try { - echo " --> Check for doesntExist: "; - var_dump($rc->getProperty("doesntExist")); + echo " --> Check for doesNotExist: "; + var_dump($rc->getProperty("doesNotExist")); } catch (exception $e) { echo $e->getMessage() . "\n"; } @@ -73,7 +73,7 @@ Reflecting on class pubf: string(4) "pubf" } --> Check for A: Property A does not exist - --> Check for doesntExist: Property doesntExist does not exist + --> Check for doesNotExist: Property doesNotExist does not exist Reflecting on class subpubf: --> Check for s: object(ReflectionProperty)#%d (2) { ["name"]=> @@ -88,7 +88,7 @@ Reflecting on class subpubf: string(4) "pubf" } --> Check for A: Property A does not exist - --> Check for doesntExist: Property doesntExist does not exist + --> Check for doesNotExist: Property doesNotExist does not exist Reflecting on class protf: --> Check for s: object(ReflectionProperty)#%d (2) { ["name"]=> @@ -103,7 +103,7 @@ Reflecting on class protf: string(5) "protf" } --> Check for A: Property A does not exist - --> Check for doesntExist: Property doesntExist does not exist + --> Check for doesNotExist: Property doesNotExist does not exist Reflecting on class subprotf: --> Check for s: object(ReflectionProperty)#%d (2) { ["name"]=> @@ -118,7 +118,7 @@ Reflecting on class subprotf: string(5) "protf" } --> Check for A: Property A does not exist - --> Check for doesntExist: Property doesntExist does not exist + --> Check for doesNotExist: Property doesNotExist does not exist Reflecting on class privf: --> Check for s: object(ReflectionProperty)#%d (2) { ["name"]=> @@ -133,7 +133,7 @@ Reflecting on class privf: string(5) "privf" } --> Check for A: Property A does not exist - --> Check for doesntExist: Property doesntExist does not exist + --> Check for doesNotExist: Property doesNotExist does not exist Reflecting on class subprivf: --> Check for s: object(ReflectionProperty)#%d (2) { ["name"]=> @@ -143,4 +143,4 @@ Reflecting on class subprivf: } --> Check for a: Property a does not exist --> Check for A: Property A does not exist - --> Check for doesntExist: Property doesntExist does not exist + --> Check for doesNotExist: Property doesNotExist does not exist diff --git a/ext/reflection/tests/ReflectionClass_getProperty_002.phpt b/ext/reflection/tests/ReflectionClass_getProperty_002.phpt index 68522e097a..d9a2ebcd71 100644 --- a/ext/reflection/tests/ReflectionClass_getProperty_002.phpt +++ b/ext/reflection/tests/ReflectionClass_getProperty_002.phpt @@ -13,12 +13,12 @@ $rc = new ReflectionClass("C"); echo "Check invalid params:\n"; try { var_dump($rc->getProperty()); -} catch (exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($rc->getProperty("a", "a")); -} catch (exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { @@ -43,30 +43,22 @@ try { } try { var_dump($rc->getProperty(array(1,2,3))); -} catch (exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($rc->getProperty(new C)); -} catch (exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } ?> ---EXPECTF-- +--EXPECT-- Check invalid params: - -Warning: ReflectionClass::getProperty() expects exactly 1 parameter, 0 given in %s on line 9 -NULL - -Warning: ReflectionClass::getProperty() expects exactly 1 parameter, 2 given in %s on line 14 -NULL +ReflectionClass::getProperty() expects exactly 1 parameter, 0 given +ReflectionClass::getProperty() expects exactly 1 parameter, 2 given Property does not exist Property 1 does not exist Property 1.5 does not exist Property 1 does not exist - -Warning: ReflectionClass::getProperty() expects parameter 1 to be string, array given in %s on line 39 -NULL - -Warning: ReflectionClass::getProperty() expects parameter 1 to be string, object given in %s on line 44 -NULL +ReflectionClass::getProperty() expects parameter 1 to be string, array given +ReflectionClass::getProperty() expects parameter 1 to be string, object given diff --git a/ext/reflection/tests/ReflectionClass_getProperty_003.phpt b/ext/reflection/tests/ReflectionClass_getProperty_003.phpt index 61d63362dc..7011a0912c 100644 --- a/ext/reflection/tests/ReflectionClass_getProperty_003.phpt +++ b/ext/reflection/tests/ReflectionClass_getProperty_003.phpt @@ -70,7 +70,7 @@ showInfo("privB"); showInfo("pubC"); showInfo("protC"); showInfo("privC"); -showInfo("doesntExist"); +showInfo("doesNotExist"); showInfo("A::pubC"); showInfo("A::protC"); @@ -89,9 +89,9 @@ showInfo("C::privC"); showInfo("X::pubC"); showInfo("X::protC"); showInfo("X::privC"); -showInfo("X::doesntExist"); +showInfo("X::doesNotExist"); -showInfo("doesntexist::doesntExist"); +showInfo("doesNotexist::doesNotExist"); ?> --EXPECTF-- @@ -155,8 +155,8 @@ object(ReflectionProperty)#%d (2) { string(1) "C" } Cannot access non-public member C::$privC ---- (Reflecting on doesntExist) --- -Property doesntExist does not exist +--- (Reflecting on doesNotExist) --- +Property doesNotExist does not exist --- (Reflecting on A::pubC) --- object(ReflectionProperty)#%d (2) { ["name"]=> @@ -245,7 +245,7 @@ Fully qualified property name X::pubC does not specify a base class of C Fully qualified property name X::protC does not specify a base class of C --- (Reflecting on X::privC) --- Fully qualified property name X::privC does not specify a base class of C ---- (Reflecting on X::doesntExist) --- -Fully qualified property name X::doesntExist does not specify a base class of C ---- (Reflecting on doesntexist::doesntExist) --- -Class doesntexist does not exist +--- (Reflecting on X::doesNotExist) --- +Fully qualified property name X::doesNotExist does not specify a base class of C +--- (Reflecting on doesNotexist::doesNotExist) --- +Class doesnotexist does not exist diff --git a/ext/reflection/tests/ReflectionClass_getProperty_004.phpt b/ext/reflection/tests/ReflectionClass_getProperty_004.phpt index ce2aa57871..95f821e472 100644 --- a/ext/reflection/tests/ReflectionClass_getProperty_004.phpt +++ b/ext/reflection/tests/ReflectionClass_getProperty_004.phpt @@ -70,7 +70,7 @@ showInfo("privB"); showInfo("pubC"); showInfo("protC"); showInfo("privC"); -showInfo("doesntExist"); +showInfo("doesNotExist"); showInfo("A::pubC"); showInfo("A::protC"); @@ -89,9 +89,9 @@ showInfo("C::privC"); showInfo("X::pubC"); showInfo("X::protC"); showInfo("X::privC"); -showInfo("X::doesntExist"); +showInfo("X::doesNotExist"); -showInfo("doesntexist::doesntExist"); +showInfo("doesNotexist::doesNotExist"); ?> --EXPECTF-- @@ -155,8 +155,8 @@ object(ReflectionProperty)#%d (2) { string(1) "C" } Cannot access non-public member C::$privC ---- (Reflecting on doesntExist) --- -Property doesntExist does not exist +--- (Reflecting on doesNotExist) --- +Property doesNotExist does not exist --- (Reflecting on A::pubC) --- object(ReflectionProperty)#%d (2) { ["name"]=> @@ -245,7 +245,7 @@ Fully qualified property name X::pubC does not specify a base class of C Fully qualified property name X::protC does not specify a base class of C --- (Reflecting on X::privC) --- Fully qualified property name X::privC does not specify a base class of C ---- (Reflecting on X::doesntExist) --- -Fully qualified property name X::doesntExist does not specify a base class of C ---- (Reflecting on doesntexist::doesntExist) --- -Class doesntexist does not exist +--- (Reflecting on X::doesNotExist) --- +Fully qualified property name X::doesNotExist does not specify a base class of C +--- (Reflecting on doesNotexist::doesNotExist) --- +Class doesnotexist does not exist diff --git a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt index 52fa378eb6..7c071e5ba0 100644 --- a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt +++ b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt @@ -12,12 +12,12 @@ class C { $rc = new ReflectionClass('C'); try { var_dump($rc->getStaticPropertyValue("x", "default value", 'blah')); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($rc->getStaticPropertyValue()); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { @@ -32,20 +32,15 @@ try { } try { var_dump($rc->getStaticPropertyValue(array(1,2,3))); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } ?> ---EXPECTF-- -Warning: ReflectionClass::getStaticPropertyValue() expects at most 2 parameters, 3 given in %s on line 8 -NULL - -Warning: ReflectionClass::getStaticPropertyValue() expects at least 1 parameter, 0 given in %s on line 13 -NULL +--EXPECT-- +ReflectionClass::getStaticPropertyValue() expects at most 2 parameters, 3 given +ReflectionClass::getStaticPropertyValue() expects at least 1 parameter, 0 given Class C does not have a property named string(3) "def" - -Warning: ReflectionClass::getStaticPropertyValue() expects parameter 1 to be string, array given in %s on line 28 -NULL +ReflectionClass::getStaticPropertyValue() expects parameter 1 to be string, array given diff --git a/ext/reflection/tests/ReflectionClass_hasConstant_001.phpt b/ext/reflection/tests/ReflectionClass_hasConstant_001.phpt index 84e334ba19..22ef1f50c5 100644 --- a/ext/reflection/tests/ReflectionClass_hasConstant_001.phpt +++ b/ext/reflection/tests/ReflectionClass_hasConstant_001.phpt @@ -19,14 +19,14 @@ var_dump($rc->hasConstant("myConst")); echo "Check existing constant, different case: "; var_dump($rc->hasConstant("MyCoNsT")); echo "Check absent constant: "; -var_dump($rc->hasConstant("doesntExist")); +var_dump($rc->hasConstant("doesNotExist")); $rd = new ReflectionClass("D"); echo "Check inherited constant: "; var_dump($rd->hasConstant("myConst")); echo "Check absent constant: "; -var_dump($rd->hasConstant("doesntExist")); +var_dump($rd->hasConstant("doesNotExist")); ?> --EXPECT-- Check existing constant: bool(true) diff --git a/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt b/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt index 14c847401d..257d9aa9da 100644 --- a/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt +++ b/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt @@ -11,30 +11,14 @@ class C { $rc = new ReflectionClass("C"); echo "Check invalid params:\n"; -var_dump($rc->hasConstant()); -var_dump($rc->hasConstant("myConst", "myConst")); var_dump($rc->hasConstant(null)); var_dump($rc->hasConstant(1)); var_dump($rc->hasConstant(1.5)); var_dump($rc->hasConstant(true)); -var_dump($rc->hasConstant(array(1,2,3))); -var_dump($rc->hasConstant(new C)); ?> ---EXPECTF-- +--EXPECT-- Check invalid params: - -Warning: ReflectionClass::hasConstant() expects exactly 1 parameter, 0 given in %s on line 8 -NULL - -Warning: ReflectionClass::hasConstant() expects exactly 1 parameter, 2 given in %s on line 9 -NULL bool(false) bool(false) bool(false) bool(false) - -Warning: ReflectionClass::hasConstant() expects parameter 1 to be string, array given in %s on line 14 -NULL - -Warning: ReflectionClass::hasConstant() expects parameter 1 to be string, object given in %s on line 15 -NULL diff --git a/ext/reflection/tests/ReflectionClass_hasMethod_001.phpt b/ext/reflection/tests/ReflectionClass_hasMethod_001.phpt index dec76febe1..bf2a3c9bb5 100644 --- a/ext/reflection/tests/ReflectionClass_hasMethod_001.phpt +++ b/ext/reflection/tests/ReflectionClass_hasMethod_001.phpt @@ -37,8 +37,8 @@ foreach($classes as $class) { var_dump($rc->hasMethod("s")); echo " --> Check for F(): "; var_dump($rc->hasMethod("F")); - echo " --> Check for doesntExist(): "; - var_dump($rc->hasMethod("doesntExist")); + echo " --> Check for doesNotExist(): "; + var_dump($rc->hasMethod("doesNotExist")); } ?> --EXPECT-- @@ -46,30 +46,30 @@ Reflecting on class pubf: --> Check for f(): bool(true) --> Check for s(): bool(true) --> Check for F(): bool(true) - --> Check for doesntExist(): bool(false) + --> Check for doesNotExist(): bool(false) Reflecting on class subpubf: --> Check for f(): bool(true) --> Check for s(): bool(true) --> Check for F(): bool(true) - --> Check for doesntExist(): bool(false) + --> Check for doesNotExist(): bool(false) Reflecting on class protf: --> Check for f(): bool(true) --> Check for s(): bool(true) --> Check for F(): bool(true) - --> Check for doesntExist(): bool(false) + --> Check for doesNotExist(): bool(false) Reflecting on class subprotf: --> Check for f(): bool(true) --> Check for s(): bool(true) --> Check for F(): bool(true) - --> Check for doesntExist(): bool(false) + --> Check for doesNotExist(): bool(false) Reflecting on class privf: --> Check for f(): bool(true) --> Check for s(): bool(true) --> Check for F(): bool(true) - --> Check for doesntExist(): bool(false) + --> Check for doesNotExist(): bool(false) Reflecting on class subprivf: --> Check for f(): bool(true) --> Check for s(): bool(true) --> Check for F(): bool(true) - --> Check for doesntExist(): bool(false) + --> Check for doesNotExist(): bool(false) diff --git a/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt b/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt index 63fe8791fc..77f2865a31 100644 --- a/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt +++ b/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt @@ -11,30 +11,14 @@ class C { $rc = new ReflectionClass("C"); echo "Check invalid params:\n"; -var_dump($rc->hasMethod()); -var_dump($rc->hasMethod("f", "f")); var_dump($rc->hasMethod(null)); var_dump($rc->hasMethod(1)); var_dump($rc->hasMethod(1.5)); var_dump($rc->hasMethod(true)); -var_dump($rc->hasMethod(array(1,2,3))); -var_dump($rc->hasMethod(new C)); ?> ---EXPECTF-- +--EXPECT-- Check invalid params: - -Warning: ReflectionClass::hasMethod() expects exactly 1 parameter, 0 given in %s on line 8 -NULL - -Warning: ReflectionClass::hasMethod() expects exactly 1 parameter, 2 given in %s on line 9 -NULL bool(false) bool(false) bool(false) bool(false) - -Warning: ReflectionClass::hasMethod() expects parameter 1 to be string, array given in %s on line 14 -NULL - -Warning: ReflectionClass::hasMethod() expects parameter 1 to be string, object given in %s on line 15 -NULL diff --git a/ext/reflection/tests/ReflectionClass_hasProperty_001.phpt b/ext/reflection/tests/ReflectionClass_hasProperty_001.phpt index a6c3753a78..6abf392eae 100644 --- a/ext/reflection/tests/ReflectionClass_hasProperty_001.phpt +++ b/ext/reflection/tests/ReflectionClass_hasProperty_001.phpt @@ -37,8 +37,8 @@ foreach($classes as $class) { var_dump($rc->hasProperty("a")); echo " --> Check for A: "; var_dump($rc->hasProperty("A")); - echo " --> Check for doesntExist: "; - var_dump($rc->hasProperty("doesntExist")); + echo " --> Check for doesNotExist: "; + var_dump($rc->hasProperty("doesNotExist")); } ?> --EXPECT-- @@ -46,29 +46,29 @@ Reflecting on class pubf: --> Check for s: bool(true) --> Check for a: bool(true) --> Check for A: bool(false) - --> Check for doesntExist: bool(false) + --> Check for doesNotExist: bool(false) Reflecting on class subpubf: --> Check for s: bool(true) --> Check for a: bool(true) --> Check for A: bool(false) - --> Check for doesntExist: bool(false) + --> Check for doesNotExist: bool(false) Reflecting on class protf: --> Check for s: bool(true) --> Check for a: bool(true) --> Check for A: bool(false) - --> Check for doesntExist: bool(false) + --> Check for doesNotExist: bool(false) Reflecting on class subprotf: --> Check for s: bool(true) --> Check for a: bool(true) --> Check for A: bool(false) - --> Check for doesntExist: bool(false) + --> Check for doesNotExist: bool(false) Reflecting on class privf: --> Check for s: bool(true) --> Check for a: bool(true) --> Check for A: bool(false) - --> Check for doesntExist: bool(false) + --> Check for doesNotExist: bool(false) Reflecting on class subprivf: --> Check for s: bool(true) --> Check for a: bool(false) --> Check for A: bool(false) - --> Check for doesntExist: bool(false) + --> Check for doesNotExist: bool(false) diff --git a/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt b/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt index 753890394f..a1bbb9e73c 100644 --- a/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt +++ b/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt @@ -11,30 +11,14 @@ class C { $rc = new ReflectionClass("C"); echo "Check invalid params:\n"; -var_dump($rc->hasProperty()); -var_dump($rc->hasProperty("a", "a")); var_dump($rc->hasProperty(null)); var_dump($rc->hasProperty(1)); var_dump($rc->hasProperty(1.5)); var_dump($rc->hasProperty(true)); -var_dump($rc->hasProperty(array(1,2,3))); -var_dump($rc->hasProperty(new C)); ?> --EXPECTF-- Check invalid params: - -Warning: ReflectionClass::hasProperty() expects exactly 1 parameter, 0 given in %s on line 8 -NULL - -Warning: ReflectionClass::hasProperty() expects exactly 1 parameter, 2 given in %s on line 9 -NULL bool(false) bool(false) bool(false) bool(false) - -Warning: ReflectionClass::hasProperty() expects parameter 1 to be string, array given in %s on line 14 -NULL - -Warning: ReflectionClass::hasProperty() expects parameter 1 to be string, object given in %s on line 15 -NULL diff --git a/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt b/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt index d1cbc8ae47..5176dd75ad 100644 --- a/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt +++ b/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt @@ -41,12 +41,12 @@ foreach ($rcs as $childName => $child) { echo "\n\nTest bad arguments:\n"; try { var_dump($rcs['A']->implementsInterface()); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($rcs['A']->implementsInterface('C', 'C')); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { @@ -144,12 +144,8 @@ Does I2 implement I2? Test bad arguments: - -Warning: ReflectionClass::implementsInterface() expects exactly 1 parameter, 0 given in %s on line 37 -NULL - -Warning: ReflectionClass::implementsInterface() expects exactly 1 parameter, 2 given in %s on line 42 -NULL +ReflectionClass::implementsInterface() expects exactly 1 parameter, 0 given +ReflectionClass::implementsInterface() expects exactly 1 parameter, 2 given Parameter one must either be a string or a ReflectionClass object Interface ThisClassDoesNotExist does not exist Parameter one must either be a string or a ReflectionClass object diff --git a/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt b/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt index 1378edd3d2..e688b40f46 100644 --- a/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt +++ b/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt @@ -17,39 +17,16 @@ class privateCtorNew { private function __construct() {} } -class publicCtorOld { - public function publicCtorOld() {} -} - -class protectedCtorOld { - protected function protectedCtorOld() {} -} - -class privateCtorOld { - private function privateCtorOld() {} -} - - -$classes = array("noCtor", "publicCtorNew", "protectedCtorNew", "privateCtorNew", - "publicCtorOld", "protectedCtorOld", "privateCtorOld"); - -foreach($classes as $class ) { +$classes = array("noCtor", "publicCtorNew", "protectedCtorNew", "privateCtorNew"); +foreach ($classes as $class) { $reflectionClass = new ReflectionClass($class); echo "Is $class instantiable? "; var_dump($reflectionClass->IsInstantiable()); } ?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; publicCtorOld has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; protectedCtorOld has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; privateCtorOld has a deprecated constructor in %s on line %d +--EXPECT-- Is noCtor instantiable? bool(true) Is publicCtorNew instantiable? bool(true) Is protectedCtorNew instantiable? bool(false) Is privateCtorNew instantiable? bool(false) -Is publicCtorOld instantiable? bool(true) -Is protectedCtorOld instantiable? bool(false) -Is privateCtorOld instantiable? bool(false) diff --git a/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt b/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt index 10a86d9136..af4ce9d2f4 100644 --- a/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt +++ b/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt @@ -35,16 +35,6 @@ foreach($classes as $class) { var_dump($rc->isIterateable()); } -echo "\nTest invalid params:\n"; -$rc = new ReflectionClass('IteratorImpl'); -var_dump($rc->isIterateable(null)); -var_dump($rc->isIterateable(null, null)); -var_dump($rc->isIterateable(1)); -var_dump($rc->isIterateable(1.5)); -var_dump($rc->isIterateable(true)); -var_dump($rc->isIterateable('X')); -var_dump($rc->isIterateable(null)); - echo "\nTest static invocation:\n"; ReflectionClass::isIterateable(); @@ -61,32 +51,9 @@ Is ExtendsIteratorImpl iterable? bool(true) Is ExtendsIteratorAggregateImpl iterable? bool(true) Is A iterable? bool(false) -Test invalid params: - -Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 34 -NULL - -Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 2 given in %s on line 35 -NULL - -Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 36 -NULL - -Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 37 -NULL - -Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 38 -NULL - -Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 39 -NULL - -Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 40 -NULL - Test static invocation: -Fatal error: Uncaught Error: Non-static method ReflectionClass::isIterateable() cannot be called statically in %s:43 +Fatal error: Uncaught Error: Non-static method ReflectionClass::isIterateable() cannot be called statically in %s:%d Stack trace: #0 {main} - thrown in %s on line 43 + thrown in %s on line %d diff --git a/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt b/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt index 368ea7d7ec..03d17e223e 100644 --- a/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt +++ b/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt @@ -11,12 +11,12 @@ $rc = new ReflectionClass('A'); echo "\n\nTest bad arguments:\n"; try { var_dump($rc->isSubclassOf()); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($rc->isSubclassOf('C', 'C')); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { @@ -35,14 +35,10 @@ try { echo $e->getMessage() . "\n"; } ?> ---EXPECTF-- +--EXPECT-- Test bad arguments: - -Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given in %s on line 7 -NULL - -Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given in %s on line 12 -NULL +ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given +ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given Parameter one must either be a string or a ReflectionClass object Class ThisClassDoesNotExist does not exist Parameter one must either be a string or a ReflectionClass object diff --git a/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt b/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt index 068710311d..9f721a4ad4 100644 --- a/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt +++ b/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt @@ -5,11 +5,6 @@ Robin Fernandes <robinf@php.net> Steve Seear <stevseea@php.net> --FILE-- <?php -class A { - public function A() { - echo "In constructor of class A\n"; - } -} class B { public function __construct($a, $b) { @@ -32,33 +27,18 @@ class E { } -$rcA = new ReflectionClass('A'); $rcB = new ReflectionClass('B'); $rcC = new ReflectionClass('C'); $rcD = new ReflectionClass('D'); $rcE = new ReflectionClass('E'); try { - var_dump($rcA->newInstanceArgs()); -} catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; -} -try { - var_dump($rcA->newInstanceArgs(array('x'))); + $rcB->newInstanceArgs(); } catch (Throwable $e) { echo "Exception: " . $e->getMessage() . "\n"; } -try { - var_dump($rcB->newInstanceArgs()); -} catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; -} -try { - var_dump($rcB->newInstanceArgs(array('x', 123))); -} catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; -} +var_dump($rcB->newInstanceArgs(array('x', 123))); try { $rcC->newInstanceArgs(); @@ -85,13 +65,6 @@ try { } ?> --EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d -In constructor of class A -object(A)#%d (0) { -} -In constructor of class A -object(A)#%d (0) { -} Exception: Too few arguments to function B::__construct(), 0 passed and exactly 2 expected In constructor of class B with args x, 123 object(B)#%d (0) { diff --git a/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt b/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt index bd27dfc173..de4fe65ace 100644 --- a/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt +++ b/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt @@ -16,8 +16,8 @@ var_dump($a); ?> --EXPECTF-- -Fatal error: Uncaught TypeError: Argument 1 passed to ReflectionClass::newInstanceArgs() must be of the type array, string given in %s:8 +Fatal error: Uncaught TypeError: ReflectionClass::newInstanceArgs() expects parameter 1 to be array, string given in %s:%d Stack trace: #0 %s(%d): ReflectionClass->newInstanceArgs('x') #1 {main} - thrown in %s on line 8 + thrown in %s on line %d diff --git a/ext/reflection/tests/ReflectionClass_newInstance_001.phpt b/ext/reflection/tests/ReflectionClass_newInstance_001.phpt index c91d2ee958..bf68098a7d 100644 --- a/ext/reflection/tests/ReflectionClass_newInstance_001.phpt +++ b/ext/reflection/tests/ReflectionClass_newInstance_001.phpt @@ -5,11 +5,6 @@ Robin Fernandes <robinf@php.net> Steve Seear <stevseea@php.net> --FILE-- <?php -class A { - public function A() { - echo "In constructor of class A\n"; - } -} class B { public function __construct($a, $b) { @@ -28,20 +23,15 @@ class D { echo "In constructor of class D\n"; } } + class E { } - -$rcA = new ReflectionClass('A'); $rcB = new ReflectionClass('B'); $rcC = new ReflectionClass('C'); $rcD = new ReflectionClass('D'); $rcE = new ReflectionClass('E'); -$a1 = $rcA->newInstance(); -$a2 = $rcA->newInstance('x'); -var_dump($a1, $a2); - try { var_dump($rcB->newInstance()); } catch (Throwable $e) { @@ -78,13 +68,6 @@ try { } ?> --EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d -In constructor of class A -In constructor of class A -object(A)#%d (0) { -} -object(A)#%d (0) { -} Exception: Too few arguments to function B::__construct(), 0 passed and exactly 2 expected In constructor of class B with args x, 123 object(B)#%d (0) { diff --git a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt index fb472681ca..6d3cf3a44f 100644 --- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt +++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt @@ -12,17 +12,17 @@ class C { $rc = new ReflectionClass('C'); try { var_dump($rc->setStaticPropertyValue("x", "default value", 'blah')); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($rc->setStaticPropertyValue()); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($rc->setStaticPropertyValue(null)); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { @@ -37,23 +37,16 @@ try { } try { var_dump($rc->setStaticPropertyValue(array(1,2,3), 'blah')); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } ?> ---EXPECTF-- -Warning: ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 3 given in %s on line 8 -NULL - -Warning: ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 0 given in %s on line 13 -NULL - -Warning: ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 1 given in %s on line 18 -NULL +--EXPECT-- +ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 3 given +ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 0 given +ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 1 given Class C does not have a property named Class C does not have a property named 1.5 - -Warning: ReflectionClass::setStaticPropertyValue() expects parameter 1 to be string, array given in %s on line 33 -NULL +ReflectionClass::setStaticPropertyValue() expects parameter 1 to be string, array given diff --git a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt index a83900a123..352a79ece8 100644 --- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt +++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt @@ -31,7 +31,7 @@ var_dump(Test::$y); ?> --EXPECT-- -Typed property Test::$y must be int, string used +Cannot assign string to property Test::$y of type int int(2) int(21) Cannot assign string to reference held by property Test::$y of type int diff --git a/ext/reflection/tests/ReflectionClass_toString_001.phpt b/ext/reflection/tests/ReflectionClass_toString_001.phpt index 2cfd808cb8..a70e09fa68 100644 --- a/ext/reflection/tests/ReflectionClass_toString_001.phpt +++ b/ext/reflection/tests/ReflectionClass_toString_001.phpt @@ -25,7 +25,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] { - Parameters [2] { Parameter #0 [ <required> $argument ] - Parameter #1 [ <optional> $return ] + Parameter #1 [ <optional> bool $return ] } } } @@ -123,49 +123,49 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] { Method [ <internal:Reflection> public method hasMethod ] { - Parameters [1] { - Parameter #0 [ <required> $name ] + Parameter #0 [ <required> string $name ] } } Method [ <internal:Reflection> public method getMethod ] { - Parameters [1] { - Parameter #0 [ <required> $name ] + Parameter #0 [ <required> string $name ] } } Method [ <internal:Reflection> public method getMethods ] { - Parameters [1] { - Parameter #0 [ <optional> $filter ] + Parameter #0 [ <optional> ?int $filter ] } } Method [ <internal:Reflection> public method hasProperty ] { - Parameters [1] { - Parameter #0 [ <required> $name ] + Parameter #0 [ <required> string $name ] } } Method [ <internal:Reflection> public method getProperty ] { - Parameters [1] { - Parameter #0 [ <required> $name ] + Parameter #0 [ <required> string $name ] } } Method [ <internal:Reflection> public method getProperties ] { - Parameters [1] { - Parameter #0 [ <optional> $filter ] + Parameter #0 [ <optional> ?int $filter ] } } Method [ <internal:Reflection> public method hasConstant ] { - Parameters [1] { - Parameter #0 [ <required> $name ] + Parameter #0 [ <required> string $name ] } } @@ -184,14 +184,14 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] { Method [ <internal:Reflection> public method getConstant ] { - Parameters [1] { - Parameter #0 [ <required> $name ] + Parameter #0 [ <required> string $name ] } } Method [ <internal:Reflection> public method getReflectionConstant ] { - Parameters [1] { - Parameter #0 [ <required> $name ] + Parameter #0 [ <required> string $name ] } } @@ -258,14 +258,14 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] { Method [ <internal:Reflection> public method isInstance ] { - Parameters [1] { - Parameter #0 [ <required> $object ] + Parameter #0 [ <required> object $object ] } } Method [ <internal:Reflection> public method newInstance ] { - Parameters [1] { - Parameter #0 [ <required> $args ] + Parameter #0 [ <optional> ...$args ] } } @@ -304,7 +304,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] { Method [ <internal:Reflection> public method getStaticPropertyValue ] { - Parameters [2] { - Parameter #0 [ <required> $name ] + Parameter #0 [ <required> string $name ] Parameter #1 [ <optional> $default ] } } @@ -312,7 +312,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] { Method [ <internal:Reflection> public method setStaticPropertyValue ] { - Parameters [2] { - Parameter #0 [ <required> $name ] + Parameter #0 [ <required> string $name ] Parameter #1 [ <required> $value ] } } diff --git a/ext/reflection/tests/ReflectionExtension_bug66218.phpt b/ext/reflection/tests/ReflectionExtension_bug66218.phpt index 77f3d230b3..f42967c089 100644 --- a/ext/reflection/tests/ReflectionExtension_bug66218.phpt +++ b/ext/reflection/tests/ReflectionExtension_bug66218.phpt @@ -2,7 +2,6 @@ ReflectionExtension::getFunctions() ##6218 zend_register_functions breaks reflection --SKIPIF-- <?php -if (PHP_SAPI != "cli") die("skip CLI only test"); if (!function_exists("dl")) die("skip need dl"); ?> --FILE-- diff --git a/ext/reflection/tests/ReflectionExtension_constructor_basic.phpt b/ext/reflection/tests/ReflectionExtension_constructor_basic.phpt index 72c8ac6bd8..25a4bbf4b8 100644 --- a/ext/reflection/tests/ReflectionExtension_constructor_basic.phpt +++ b/ext/reflection/tests/ReflectionExtension_constructor_basic.phpt @@ -9,7 +9,5 @@ $obj = new ReflectionExtension('reflection'); $test = $obj instanceof ReflectionExtension; var_dump($test); ?> -==DONE== --EXPECT-- bool(true) -==DONE== diff --git a/ext/reflection/tests/ReflectionExtension_constructor_error.phpt b/ext/reflection/tests/ReflectionExtension_constructor_error.phpt index 94071de5ab..a0b920ac08 100644 --- a/ext/reflection/tests/ReflectionExtension_constructor_error.phpt +++ b/ext/reflection/tests/ReflectionExtension_constructor_error.phpt @@ -25,9 +25,7 @@ try { ?> -==DONE== --EXPECTF-- Ok - ReflectionExtension::__construct() expects exactly %d parameter, %d given Ok - ReflectionExtension::__construct() expects exactly %d parameter, %d given Ok - ReflectionExtension::__construct() expects parameter 1 to be string, array given -==DONE== diff --git a/ext/reflection/tests/ReflectionExtension_export_basic.phpt b/ext/reflection/tests/ReflectionExtension_export_basic.phpt index 4652a409a1..42972f1574 100644 --- a/ext/reflection/tests/ReflectionExtension_export_basic.phpt +++ b/ext/reflection/tests/ReflectionExtension_export_basic.phpt @@ -11,8 +11,6 @@ ReflectionExtension::export("reflection", false); $test = ob_get_clean(); var_dump(empty($test)); ?> -==DONE== --EXPECTF-- Deprecated: Function ReflectionExtension::export() is deprecated in %s on line %d bool(false) -==DONE== diff --git a/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt b/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt index 3fea08c43f..e90209ee67 100644 --- a/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt +++ b/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt @@ -7,7 +7,6 @@ Felix De Vliegher <felix.devliegher@gmail.com> $standard = new ReflectionExtension('standard'); var_dump($standard->getClassNames()); ?> -==DONE== --EXPECTF-- array(4) { [0]=> @@ -19,4 +18,3 @@ array(4) { [3]=> %s(14) "AssertionError" } -==DONE== diff --git a/ext/reflection/tests/ReflectionExtension_getClassNames_variation1.phpt b/ext/reflection/tests/ReflectionExtension_getClassNames_variation1.phpt index 91912b9220..34f6112d98 100644 --- a/ext/reflection/tests/ReflectionExtension_getClassNames_variation1.phpt +++ b/ext/reflection/tests/ReflectionExtension_getClassNames_variation1.phpt @@ -11,8 +11,6 @@ extension_loaded('ctype') or die("skip Requires 'ctype' extension"); $extension = new ReflectionExtension('ctype'); var_dump($extension->getClassNames()); ?> -==DONE== --EXPECT-- array(0) { } -==DONE== diff --git a/ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt b/ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt index 5877f88e27..61a0d24b08 100644 --- a/ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt +++ b/ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt @@ -7,9 +7,8 @@ Thijs Lensselink <tl@lenss.nl> $ext = new ReflectionExtension('reflection'); var_dump($ext->getClasses()); ?> -==DONE== --EXPECT-- -array(17) { +array(18) { ["ReflectionException"]=> object(ReflectionClass)#2 (1) { ["name"]=> @@ -55,45 +54,49 @@ array(17) { ["name"]=> string(19) "ReflectionNamedType" } - ["ReflectionMethod"]=> + ["ReflectionUnionType"]=> object(ReflectionClass)#11 (1) { ["name"]=> + string(19) "ReflectionUnionType" + } + ["ReflectionMethod"]=> + object(ReflectionClass)#12 (1) { + ["name"]=> string(16) "ReflectionMethod" } ["ReflectionClass"]=> - object(ReflectionClass)#12 (1) { + object(ReflectionClass)#13 (1) { ["name"]=> string(15) "ReflectionClass" } ["ReflectionObject"]=> - object(ReflectionClass)#13 (1) { + object(ReflectionClass)#14 (1) { ["name"]=> string(16) "ReflectionObject" } ["ReflectionProperty"]=> - object(ReflectionClass)#14 (1) { + object(ReflectionClass)#15 (1) { ["name"]=> string(18) "ReflectionProperty" } ["ReflectionClassConstant"]=> - object(ReflectionClass)#15 (1) { + object(ReflectionClass)#16 (1) { ["name"]=> string(23) "ReflectionClassConstant" } ["ReflectionExtension"]=> - object(ReflectionClass)#16 (1) { + object(ReflectionClass)#17 (1) { ["name"]=> string(19) "ReflectionExtension" } ["ReflectionZendExtension"]=> - object(ReflectionClass)#17 (1) { + object(ReflectionClass)#18 (1) { ["name"]=> string(23) "ReflectionZendExtension" } ["ReflectionReference"]=> - object(ReflectionClass)#18 (1) { + object(ReflectionClass)#19 (1) { ["name"]=> string(19) "ReflectionReference" } } -==DONE== diff --git a/ext/reflection/tests/ReflectionExtension_getDependencies_basic.phpt b/ext/reflection/tests/ReflectionExtension_getDependencies_basic.phpt index 8b5293a48f..306380c9d1 100644 --- a/ext/reflection/tests/ReflectionExtension_getDependencies_basic.phpt +++ b/ext/reflection/tests/ReflectionExtension_getDependencies_basic.phpt @@ -11,7 +11,6 @@ if (!extension_loaded("dom")) die("skip no dom extension"); $dom = new ReflectionExtension('dom'); var_dump($dom->getDependencies()); ?> -==DONE== --EXPECTF-- array(2) { ["libxml"]=> @@ -19,4 +18,3 @@ array(2) { ["domxml"]=> %s(9) "Conflicts" } -==DONE== diff --git a/ext/reflection/tests/ReflectionExtension_getDependencies_variation2.phpt b/ext/reflection/tests/ReflectionExtension_getDependencies_variation2.phpt index 5b0ade5da2..be13fe27a8 100644 --- a/ext/reflection/tests/ReflectionExtension_getDependencies_variation2.phpt +++ b/ext/reflection/tests/ReflectionExtension_getDependencies_variation2.phpt @@ -7,10 +7,8 @@ Felix De Vliegher <felix.devliegher@gmail.com> $standard = new ReflectionExtension('standard'); var_dump($standard->getDependencies()); ?> -==DONE== --EXPECTF-- array(1) { ["session"]=> %s(8) "Optional" } -==DONE== diff --git a/ext/reflection/tests/ReflectionExtension_getName_basic.phpt b/ext/reflection/tests/ReflectionExtension_getName_basic.phpt index 9dae1f3a6b..c26044f710 100644 --- a/ext/reflection/tests/ReflectionExtension_getName_basic.phpt +++ b/ext/reflection/tests/ReflectionExtension_getName_basic.phpt @@ -8,7 +8,5 @@ Leon Luijkx <leon@phpgg.nl> $obj = new ReflectionExtension('reflection'); var_dump($obj->getName()); ?> -==DONE== --EXPECT-- string(10) "Reflection" -==DONE== diff --git a/ext/reflection/tests/ReflectionExtension_getVersion_basic.phpt b/ext/reflection/tests/ReflectionExtension_getVersion_basic.phpt index 19dee82710..0139a1c4ae 100644 --- a/ext/reflection/tests/ReflectionExtension_getVersion_basic.phpt +++ b/ext/reflection/tests/ReflectionExtension_getVersion_basic.phpt @@ -10,7 +10,5 @@ $var = $obj->getVersion() ? $obj->getVersion() : null; $test = floatval($var) == $var ? true : false; var_dump($test); ?> -==DONE== --EXPECT-- bool(true) -==DONE== diff --git a/ext/reflection/tests/ReflectionExtension_info_basic.phpt b/ext/reflection/tests/ReflectionExtension_info_basic.phpt index 48f6a65099..6eac5a56e7 100644 --- a/ext/reflection/tests/ReflectionExtension_info_basic.phpt +++ b/ext/reflection/tests/ReflectionExtension_info_basic.phpt @@ -12,8 +12,6 @@ $testb = ob_get_clean(); var_dump($testa); var_dump(strlen($testb) > 24); ?> -==DONE== --EXPECT-- NULL bool(true) -==DONE== diff --git a/ext/reflection/tests/ReflectionExtension_isPersistant.phpt b/ext/reflection/tests/ReflectionExtension_isPersistant.phpt index a78a8bbc3d..642a79bd3b 100644 --- a/ext/reflection/tests/ReflectionExtension_isPersistant.phpt +++ b/ext/reflection/tests/ReflectionExtension_isPersistant.phpt @@ -5,7 +5,5 @@ ReflectionExtension::isPersistent() $obj = new ReflectionExtension('reflection'); var_dump($obj->isPersistent()); ?> -==DONE== --EXPECT-- bool(true) -==DONE== diff --git a/ext/reflection/tests/ReflectionExtension_isTemporary.phpt b/ext/reflection/tests/ReflectionExtension_isTemporary.phpt index be97641be1..791662ff13 100644 --- a/ext/reflection/tests/ReflectionExtension_isTemporary.phpt +++ b/ext/reflection/tests/ReflectionExtension_isTemporary.phpt @@ -5,7 +5,5 @@ ReflectionExtension::isTemporary() $obj = new ReflectionExtension('reflection'); var_dump($obj->isTemporary()); ?> -==DONE== --EXPECT-- bool(false) -==DONE== diff --git a/ext/reflection/tests/ReflectionFunction_getClosure_basic.phpt b/ext/reflection/tests/ReflectionFunction_getClosure_basic.phpt index 4c76959aec..bb72137f69 100644 --- a/ext/reflection/tests/ReflectionFunction_getClosure_basic.phpt +++ b/ext/reflection/tests/ReflectionFunction_getClosure_basic.phpt @@ -29,9 +29,7 @@ $closure = $func->getClosure(); $closure( 'succeeded' ); ?> -===DONE=== --EXPECT-- *** Testing ReflectionFunction::getClosure() : basic functionality *** string(19) "Inside foo function" string(16) "Arg is succeeded" -===DONE=== diff --git a/ext/reflection/tests/ReflectionMethod_006.phpt b/ext/reflection/tests/ReflectionMethod_006.phpt index 627dc96f32..81f8116d77 100644 --- a/ext/reflection/tests/ReflectionMethod_006.phpt +++ b/ext/reflection/tests/ReflectionMethod_006.phpt @@ -17,79 +17,7 @@ try { echo "Ok - ".$re->getMessage().PHP_EOL; } -class C { - public function f() {} -} - -$rm = new ReflectionMethod('C', 'f'); - -var_dump($rm->isFinal(1)); -var_dump($rm->isAbstract(1)); -var_dump($rm->isPrivate(1)); -var_dump($rm->isProtected(1)); -var_dump($rm->isPublic(1)); -var_dump($rm->isStatic(1)); -var_dump($rm->isConstructor(1)); -var_dump($rm->isDestructor(1)); -var_dump($rm->getModifiers(1)); -var_dump($rm->isInternal(1)); -var_dump($rm->isUserDefined(1)); -var_dump($rm->getFileName(1)); -var_dump($rm->getStartLine(1)); -var_dump($rm->getEndLine(1)); -var_dump($rm->getStaticVariables(1)); -var_dump($rm->getName(1)); - - ?> ---EXPECTF-- +--EXPECT-- Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 0 given Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 3 given - -Warning: ReflectionMethod::isFinal() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionMethod::isAbstract() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionMethod::isPrivate() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionMethod::isProtected() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionMethod::isPublic() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionMethod::isStatic() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionMethod::isConstructor() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionMethod::isDestructor() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionMethod::getModifiers() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionFunctionAbstract::isInternal() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionFunctionAbstract::isUserDefined() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionFunctionAbstract::getFileName() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionFunctionAbstract::getStartLine() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionFunctionAbstract::getEndLine() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionFunctionAbstract::getStaticVariables() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionFunctionAbstract::getName() expects exactly 0 parameters, 1 given in %s on line %d -NULL diff --git a/ext/reflection/tests/ReflectionMethod_basic2.phpt b/ext/reflection/tests/ReflectionMethod_basic2.phpt index 71ef9e95d9..46abc6b816 100644 --- a/ext/reflection/tests/ReflectionMethod_basic2.phpt +++ b/ext/reflection/tests/ReflectionMethod_basic2.phpt @@ -166,7 +166,7 @@ string(%d) "Method [ <internal:Reflection, ctor> public method __construct ] { - Parameters [2] { Parameter #0 [ <required> $class ] - Parameter #1 [ <required> $name ] + Parameter #1 [ <required> string $name ] } } " @@ -178,7 +178,7 @@ string(%d) "Method [ <internal:Reflection, ctor> public method __construct ] { - Parameters [2] { Parameter #0 [ <required> $class ] - Parameter #1 [ <required> $name ] + Parameter #1 [ <required> string $name ] } } " diff --git a/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt index 243c59504b..da108d258d 100644 --- a/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt +++ b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt @@ -19,21 +19,6 @@ echo "\nInherited new-style constructor\n"; $methodInfo = new ReflectionMethod("ExtendsNewCtor::__construct"); var_dump($methodInfo->isConstructor()); -class OldCtor { - function OldCtor() { - echo "In " . __METHOD__ . "\n"; - } -} -echo "\nOld-style constructor:\n"; -$methodInfo = new ReflectionMethod("OldCtor::OldCtor"); -var_dump($methodInfo->isConstructor()); - -class ExtendsOldCtor extends OldCtor { -} -echo "\nInherited old-style constructor:\n"; -$methodInfo = new ReflectionMethod("ExtendsOldCtor::OldCtor"); -var_dump($methodInfo->isConstructor()); - class X { function Y() { echo "In " . __METHOD__ . "\n"; @@ -49,69 +34,16 @@ echo "\nInherited method of the same name as the class:\n"; $methodInfo = new ReflectionMethod("Y::Y"); var_dump($methodInfo->isConstructor()); -class OldAndNewCtor { - function OldAndNewCtor() { - echo "In " . __METHOD__ . "\n"; - } - - function __construct() { - echo "In " . __METHOD__ . "\n"; - } -} -echo "\nOld-style constructor:\n"; -$methodInfo = new ReflectionMethod("OldAndNewCtor::OldAndNewCtor"); -var_dump($methodInfo->isConstructor()); - -echo "\nRedefined constructor:\n"; -$methodInfo = new ReflectionMethod("OldAndNewCtor::__construct"); -var_dump($methodInfo->isConstructor()); - -class NewAndOldCtor { - function __construct() { - echo "In " . __METHOD__ . "\n"; - } - - function NewAndOldCtor() { - echo "In " . __METHOD__ . "\n"; - } -} -echo "\nNew-style constructor:\n"; -$methodInfo = new ReflectionMethod("NewAndOldCtor::__construct"); -var_dump($methodInfo->isConstructor()); - -echo "\nRedefined old-style constructor:\n"; -$methodInfo = new ReflectionMethod("NewAndOldCtor::NewAndOldCtor"); -var_dump($methodInfo->isConstructor()); - ?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OldCtor has a deprecated constructor in %s on line %d +--EXPECT-- New-style constructor: bool(true) Inherited new-style constructor bool(true) -Old-style constructor: -bool(true) - -Inherited old-style constructor: -bool(true) - Not a constructor: bool(false) Inherited method of the same name as the class: bool(false) - -Old-style constructor: -bool(false) - -Redefined constructor: -bool(true) - -New-style constructor: -bool(true) - -Redefined old-style constructor: -bool(false) diff --git a/ext/reflection/tests/ReflectionMethod_getClosure_basic.phpt b/ext/reflection/tests/ReflectionMethod_getClosure_basic.phpt index bf1bcf3603..105df87e73 100644 --- a/ext/reflection/tests/ReflectionMethod_getClosure_basic.phpt +++ b/ext/reflection/tests/ReflectionMethod_getClosure_basic.phpt @@ -46,10 +46,8 @@ $object->bar = 34; $closure(); ?> -===DONE=== --EXPECT-- *** Testing ReflectionMethod::getClosure() : basic functionality *** string(34) "Static Example class, Hello World!" string(22) "Example class, bar: 42" string(22) "Example class, bar: 34" -===DONE=== diff --git a/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt b/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt index d3b9ca3c81..70c77895d0 100644 --- a/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt +++ b/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt @@ -35,15 +35,7 @@ $staticmethod = $staticclass->getMethod( 'foo' ); $object = new Example(); $fakeobj = new StdClass(); -echo "\n-- Testing ReflectionMethod::getClosure() function with more than expected no. of arguments --\n"; -var_dump( $staticmethod->getClosure( 'foobar' ) ); -var_dump( $staticmethod->getClosure( 'foo', 'bar' ) ); -var_dump( $method->getClosure( $object, 'foobar' ) ); - -echo "\n-- Testing ReflectionMethod::getClosure() function with Zero arguments --\n"; -$closure = $method->getClosure(); - -echo "\n-- Testing ReflectionMethod::getClosure() function with Zero arguments --\n"; +echo "\n-- Testing ReflectionMethod::getClosure() function with invalid object --\n"; try { var_dump( $method->getClosure( $fakeobj ) ); } catch( Exception $e ) { @@ -51,23 +43,8 @@ try { } ?> -===DONE=== --EXPECTF-- *** Testing ReflectionMethod::getClosure() : error conditions *** --- Testing ReflectionMethod::getClosure() function with more than expected no. of arguments -- -object(Closure)#%d (0) { -} -object(Closure)#%d (0) { -} - -Warning: ReflectionMethod::getClosure() expects exactly 1 parameter, 2 given in %s on line %d -NULL - --- Testing ReflectionMethod::getClosure() function with Zero arguments -- - -Warning: ReflectionMethod::getClosure() expects exactly 1 parameter, 0 given in %s on line %d - --- Testing ReflectionMethod::getClosure() function with Zero arguments -- +-- Testing ReflectionMethod::getClosure() function with invalid object -- string(72) "Given object is not an instance of the class this method was declared in" -===DONE=== diff --git a/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt index d1a19c7116..d867993599 100644 --- a/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt +++ b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt @@ -75,13 +75,9 @@ reflectMethodModifiers("DerivedClass"); reflectMethodModifiers("TestInterface"); reflectMethodModifiers("AbstractClass"); -echo "Wrong number of params:\n"; -$a = new ReflectionMethod('TestClass::foo'); -$a->getModifiers(1); - $a = new ReflectionMethod('ReflectionMethod::getModifiers'); -echo "\nReflectionMethod::getModifiers() modifiers:\n"; +echo "ReflectionMethod::getModifiers() modifiers:\n"; printf("0x%08x\n", $a->getModifiers()); ?> @@ -234,9 +230,5 @@ Modifiers for method AbstractClass::foo(): 0x00000041 -Wrong number of params: - -Warning: ReflectionMethod::getModifiers() expects exactly 0 parameters, 1 given in %s on line %d - ReflectionMethod::getModifiers() modifiers: 0x00000001 diff --git a/ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt b/ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt index 6c81728f91..34e73c9a69 100644 --- a/ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt +++ b/ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt @@ -24,4 +24,4 @@ try { ?> --EXPECT-- -string(89) "Argument 2 passed to ReflectionMethod::invokeArgs() must be of the type array, bool given" +string(74) "ReflectionMethod::invokeArgs() expects parameter 2 to be array, bool given" diff --git a/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt b/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt index 0c87a66153..156cc9db52 100644 --- a/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt +++ b/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt @@ -37,10 +37,6 @@ $foo = new ReflectionMethod($testClassInstance, 'foo'); $staticMethod = new ReflectionMethod('TestClass::staticMethod'); $privateMethod = new ReflectionMethod("TestClass::privateMethod"); -echo "Wrong number of parameters:\n"; -var_dump($foo->invokeArgs()); -var_dump($foo->invokeArgs(true)); - echo "\nNon-instance:\n"; try { var_dump($foo->invokeArgs(new stdClass(), array())); @@ -48,14 +44,8 @@ try { var_dump($e->getMessage()); } -echo "\nNon-object:\n"; -var_dump($foo->invokeArgs(true, array())); - echo "\nStatic method:\n"; -var_dump($staticMethod->invokeArgs()); -var_dump($staticMethod->invokeArgs(true)); -var_dump($staticMethod->invokeArgs(true, array())); var_dump($staticMethod->invokeArgs(null, array())); echo "\nPrivate method:\n"; @@ -80,32 +70,10 @@ try { ?> --EXPECTF-- -Wrong number of parameters: - -Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 1 given in %s on line %d -NULL - Non-instance: string(72) "Given object is not an instance of the class this method was declared in" -Non-object: - -Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, bool given in %s on line %d -NULL - Static method: - -Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, bool given in %s on line %d -NULL Called staticMethod() Exception: Using $this when not in object context NULL diff --git a/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt b/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt index 0a2b15fb83..6711feb4ac 100644 --- a/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt +++ b/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt @@ -60,8 +60,16 @@ var_dump($methodWithArgs->invoke($testClassInstance, 1, "arg2", 3)); echo "\nStatic method:\n"; -var_dump($staticMethod->invoke()); -var_dump($staticMethod->invoke(true)); +try { + var_dump($staticMethod->invoke()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump($staticMethod->invoke(true)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump($staticMethod->invoke(new stdClass())); echo "\nMethod that throws an exception:\n"; @@ -94,12 +102,8 @@ Called methodWithArgs(1, arg2) NULL Static method: - -Warning: ReflectionMethod::invoke() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: ReflectionMethod::invoke() expects parameter 1 to be object, bool given in %s on line %d -NULL +ReflectionMethod::invoke() expects at least 1 parameter, 0 given +ReflectionMethod::invoke() expects parameter 1 to be object, bool given Called staticMethod() Exception: Using $this when not in object context NULL diff --git a/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt b/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt index 411299f0c7..4fa86eb363 100644 --- a/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt +++ b/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt @@ -30,7 +30,7 @@ $testClassInstance->prop = "Hello"; echo "invoke() on a non-object:\n"; try { var_dump($foo->invoke(true)); -} catch (ReflectionException $e) { +} catch (TypeError $e) { var_dump($e->getMessage()); } @@ -59,9 +59,7 @@ try { ?> --EXPECTF-- invoke() on a non-object: - -Warning: ReflectionMethod::invoke() expects parameter 1 to be object, bool given in %s%eReflectionMethod_invoke_error1.php on line %d -NULL +string(71) "ReflectionMethod::invoke() expects parameter 1 to be object, bool given" invoke() on a non-instance: string(72) "Given object is not an instance of the class this method was declared in" diff --git a/ext/reflection/tests/ReflectionNamedType.phpt b/ext/reflection/tests/ReflectionNamedType.phpt index afb592127c..78fe1e8fd4 100644 --- a/ext/reflection/tests/ReflectionNamedType.phpt +++ b/ext/reflection/tests/ReflectionNamedType.phpt @@ -30,20 +30,12 @@ var_dump($return->getName()); var_dump((string) $return); ?> ---EXPECTF-- +--EXPECT-- string(11) "Traversable" - -Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d -string(11) "Traversable" -string(6) "string" - -Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d +string(12) "?Traversable" string(6) "string" +string(7) "?string" string(4) "Test" - -Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d -string(4) "Test" -string(4) "Test" - -Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d +string(5) "?Test" string(4) "Test" +string(5) "?Test" diff --git a/ext/reflection/tests/ReflectionObject_getConstant_basic.phpt b/ext/reflection/tests/ReflectionObject_getConstant_basic.phpt index 7f9bc1f35c..9e61ee90da 100644 --- a/ext/reflection/tests/ReflectionObject_getConstant_basic.phpt +++ b/ext/reflection/tests/ReflectionObject_getConstant_basic.phpt @@ -20,7 +20,7 @@ foreach($classes as $class) { echo "Reflecting on instance of class $class: \n"; $rc = new ReflectionObject(new $class); var_dump($rc->getConstant('a')); - var_dump($rc->getConstant('doesntexist')); + var_dump($rc->getConstant('doesNotexist')); } ?> --EXPECT-- diff --git a/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt index aecc9b97d2..fee873fe01 100644 --- a/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt +++ b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt @@ -9,14 +9,6 @@ class NewCtor { class ExtendsNewCtor extends NewCtor { } -class OldCtor { - function OldCtor() {} -} - -class ExtendsOldCtor extends OldCtor { -} - - class X { function Y() {} } @@ -24,15 +16,6 @@ class X { class Y extends X { } -class OldAndNewCtor { - function OldAndNewCtor() {} - function __construct() {} -} - -class NewAndOldCtor { - function __construct() {} - function NewAndOldCtor() {} -} class B { function B() {} } @@ -48,8 +31,8 @@ class D1 extends C { class D2 extends C { } -$classes = array('NewCtor', 'ExtendsNewCtor', 'OldCtor', 'ExtendsOldCtor', - 'OldAndNewCtor', 'NewAndOldCtor', 'B', 'C', 'D1', 'D2', 'X', 'Y'); +$classes = array('NewCtor', 'ExtendsNewCtor', + 'B', 'C', 'D1', 'D2', 'X', 'Y'); foreach ($classes as $class) { $rc = new ReflectionObject(new $class); @@ -63,21 +46,12 @@ foreach ($classes as $class) { } ?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OldCtor has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; C has a deprecated constructor in %s on line %d +--EXPECT-- Constructor of NewCtor: __construct Constructor of ExtendsNewCtor: __construct -Constructor of OldCtor: OldCtor -Constructor of ExtendsOldCtor: OldCtor -Constructor of OldAndNewCtor: __construct -Constructor of NewAndOldCtor: __construct -Constructor of B: B -Constructor of C: C +No constructor for B +No constructor for C Constructor of D1: __construct -Constructor of D2: C +No constructor for D2 No constructor for X No constructor for Y diff --git a/ext/reflection/tests/ReflectionObject_getName_basic.phpt b/ext/reflection/tests/ReflectionObject_getName_basic.phpt index 68cea6a1cd..1885695cb1 100644 --- a/ext/reflection/tests/ReflectionObject_getName_basic.phpt +++ b/ext/reflection/tests/ReflectionObject_getName_basic.phpt @@ -2,8 +2,6 @@ ReflectionObject::getName() - basic function test --FILE-- <?php -$r0 = new ReflectionObject(); -var_dump($r0->getName()); $r1 = new ReflectionObject(new stdClass); var_dump($r1->getName()); @@ -18,8 +16,6 @@ var_dump($r3->getName()); ?> --EXPECTF-- -Warning: ReflectionObject::__construct() expects exactly 1 parameter, 0 given in %s on line 2 -string(0) "" string(8) "stdClass" string(1) "C" string(16) "ReflectionObject" diff --git a/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt b/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt index 675bbdde8d..3baa8a0950 100644 --- a/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt +++ b/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt @@ -30,54 +30,21 @@ class privateCtorNew { } } -class publicCtorOld { - public function publicCtorOld() {} - public static function reflectionObjectFactory() { - return new ReflectionObject(new self); - } -} - -class protectedCtorOld { - protected function protectedCtorOld() {} - public static function reflectionObjectFactory() { - return new ReflectionObject(new self); - } -} - -class privateCtorOld { - private function privateCtorOld() {} - public static function reflectionObjectFactory() { - return new ReflectionObject(new self); - } -} - - $reflectionObjects = array( noCtor::reflectionObjectFactory(), publicCtorNew::reflectionObjectFactory(), protectedCtorNew::reflectionObjectFactory(), privateCtorNew::reflectionObjectFactory(), - publicCtorOld::reflectionObjectFactory(), - protectedCtorOld::reflectionObjectFactory(), - privateCtorOld::reflectionObjectFactory() ); -foreach($reflectionObjects as $reflectionObject ) { +foreach ($reflectionObjects as $reflectionObject) { $name = $reflectionObject->getName(); echo "Is $name instantiable? "; var_dump($reflectionObject->IsInstantiable()); } ?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; publicCtorOld has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; protectedCtorOld has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; privateCtorOld has a deprecated constructor in %s on line %d +--EXPECT-- Is noCtor instantiable? bool(true) Is publicCtorNew instantiable? bool(true) Is protectedCtorNew instantiable? bool(false) Is privateCtorNew instantiable? bool(false) -Is publicCtorOld instantiable? bool(true) -Is protectedCtorOld instantiable? bool(false) -Is privateCtorOld instantiable? bool(false) diff --git a/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt b/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt index f05197ebaf..a2484f9dc2 100644 --- a/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt +++ b/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt @@ -11,12 +11,12 @@ $ro = new ReflectionObject(new C); echo "\n\nTest bad arguments:\n"; try { var_dump($ro->isSubclassOf()); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($ro->isSubclassOf('C', 'C')); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { @@ -35,14 +35,10 @@ try { echo $e->getMessage() . "\n"; } ?> ---EXPECTF-- +--EXPECT-- Test bad arguments: - -Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given in %s on line 7 -NULL - -Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given in %s on line 12 -NULL +ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given +ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given Parameter one must either be a string or a ReflectionClass object Class ThisClassDoesNotExist does not exist Parameter one must either be a string or a ReflectionClass object diff --git a/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt b/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt index 11994ed705..582bcffe65 100644 --- a/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt +++ b/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt @@ -5,20 +5,12 @@ ReflectionObject::isSubclassOf() - invalid params class A {} $ro = new ReflectionObject(new A); -var_dump($ro->isSubclassOf()); -var_dump($ro->isSubclassOf('A',5)); var_dump($ro->isSubclassOf('X')); ?> --EXPECTF-- -Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given in %s on line 5 -NULL - -Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given in %s on line 6 -NULL - -Fatal error: Uncaught ReflectionException: Class X does not exist in %s:7 +Fatal error: Uncaught ReflectionException: Class X does not exist in %s:%d Stack trace: -#0 %s(7): ReflectionClass->isSubclassOf('X') +#0 %s(%d): ReflectionClass->isSubclassOf('X') #1 {main} - thrown in %s on line 7 + thrown in %s on line %d diff --git a/ext/reflection/tests/ReflectionParameter_003.phpt b/ext/reflection/tests/ReflectionParameter_003.phpt index cc092bffcc..581c486f62 100644 --- a/ext/reflection/tests/ReflectionParameter_003.phpt +++ b/ext/reflection/tests/ReflectionParameter_003.phpt @@ -56,7 +56,7 @@ foreach($refParameters as $parameter) { hello from test third is jack -Notice: Undefined variable: theIncrement in %s on line 8 +Warning: Undefined variable: theIncrement in %s on line %d parameter names from staticMethod method: object(ReflectionParameter)#%d (1) { diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt index 20f4c95dc7..7a92edc4cc 100644 --- a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt +++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt @@ -41,7 +41,6 @@ foreach ($params as $param) { } } ?> -==DONE== --EXPECT-- bool(false) bool(true) @@ -50,4 +49,3 @@ string(10) "CASE_LOWER" string(9) "self::bar" string(9) "Foo2::bar" string(12) "CONST_TEST_1" -==DONE== diff --git a/ext/reflection/tests/ReflectionParameter_export_basic.phpt b/ext/reflection/tests/ReflectionParameter_export_basic.phpt index 6f3d16a5ff..8286078135 100644 --- a/ext/reflection/tests/ReflectionParameter_export_basic.phpt +++ b/ext/reflection/tests/ReflectionParameter_export_basic.phpt @@ -12,8 +12,6 @@ foreach($reflect->getParameters() as $key => $value) { echo new ReflectionParameter('ReflectionParameterTest', $key), "\n"; } ?> -==DONE== --EXPECTF-- Parameter #0 [ <required> $test ] Parameter #1 [ <optional> $test2 = NULL ] -==DONE== diff --git a/ext/reflection/tests/ReflectionParameter_getDeclaringFunction_basic.phpt b/ext/reflection/tests/ReflectionParameter_getDeclaringFunction_basic.phpt index 59e15a7054..18d4eb69a4 100644 --- a/ext/reflection/tests/ReflectionParameter_getDeclaringFunction_basic.phpt +++ b/ext/reflection/tests/ReflectionParameter_getDeclaringFunction_basic.phpt @@ -14,7 +14,6 @@ foreach($params as $key => $value) { echo $value->getDeclaringFunction() . "\n"; } ?> -==DONE== --EXPECTF-- Function [ <user> function ReflectionParameterTest ] { @@ %s.php %d - %d @@ -34,4 +33,3 @@ Function [ <user> function ReflectionParameterTest ] { } } -==DONE== diff --git a/ext/reflection/tests/ReflectionParameter_getPosition_basic.phpt b/ext/reflection/tests/ReflectionParameter_getPosition_basic.phpt index 2807bdf66d..c5df520c42 100644 --- a/ext/reflection/tests/ReflectionParameter_getPosition_basic.phpt +++ b/ext/reflection/tests/ReflectionParameter_getPosition_basic.phpt @@ -14,8 +14,6 @@ foreach($params as $key => $value) { var_dump($value->getPosition()); } ?> -==DONE== --EXPECT-- int(0) int(1) -==DONE== diff --git a/ext/reflection/tests/ReflectionParameter_isDefault.phpt b/ext/reflection/tests/ReflectionParameter_isDefault.phpt index d8b4f0edc0..ea95878170 100644 --- a/ext/reflection/tests/ReflectionParameter_isDefault.phpt +++ b/ext/reflection/tests/ReflectionParameter_isDefault.phpt @@ -23,7 +23,6 @@ $prop2 = new ReflectionProperty($a, 'myprop'); var_dump($prop1->isDefault()); var_dump($prop2->isDefault()); ?> -==DONE== --EXPECT-- bool(true) bool(false) @@ -31,4 +30,3 @@ bool(true) bool(false) bool(true) bool(false) -==DONE== diff --git a/ext/reflection/tests/ReflectionParameter_toString_basic.phpt b/ext/reflection/tests/ReflectionParameter_toString_basic.phpt index d1a23c758d..35134b7e2d 100644 --- a/ext/reflection/tests/ReflectionParameter_toString_basic.phpt +++ b/ext/reflection/tests/ReflectionParameter_toString_basic.phpt @@ -13,9 +13,7 @@ foreach($params as $key => $value) { echo $value->__toString() . "\n"; } ?> -==DONE== --EXPECT-- Parameter #0 [ <required> $test ] Parameter #1 [ <optional> $test2 = NULL ] Parameter #2 [ <optional> ...$test3 ] -==DONE== diff --git a/ext/reflection/tests/ReflectionProperty_error.phpt b/ext/reflection/tests/ReflectionProperty_error.phpt index c8a2f11ee1..a7fdff5000 100644 --- a/ext/reflection/tests/ReflectionProperty_error.phpt +++ b/ext/reflection/tests/ReflectionProperty_error.phpt @@ -24,39 +24,8 @@ try { echo "Ok - ".$re->getMessage().PHP_EOL; } - -$rp = new ReflectionProperty('C', 'p'); -var_dump($rp->getName(1)); -var_dump($rp->isPrivate(1)); -var_dump($rp->isProtected(1)); -var_dump($rp->isPublic(1)); -var_dump($rp->isStatic(1)); -var_dump($rp->getModifiers(1)); -var_dump($rp->isDefault(1)); - ?> ---EXPECTF-- +--EXPECT-- Ok - ReflectionProperty::__construct() expects exactly 2 parameters, 0 given Ok - ReflectionProperty::__construct() expects exactly 2 parameters, 1 given Ok - ReflectionProperty::__construct() expects exactly 2 parameters, 3 given - -Warning: ReflectionProperty::getName() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionProperty::isPrivate() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionProperty::isProtected() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionProperty::isPublic() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionProperty::isStatic() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionProperty::getModifiers() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionProperty::isDefault() expects exactly 0 parameters, 1 given in %s on line %d -NULL diff --git a/ext/reflection/tests/ReflectionProperty_export_error.phpt b/ext/reflection/tests/ReflectionProperty_export_error.phpt index 114b4c0ac8..446fedf0a3 100644 --- a/ext/reflection/tests/ReflectionProperty_export_error.phpt +++ b/ext/reflection/tests/ReflectionProperty_export_error.phpt @@ -32,10 +32,6 @@ catch(Exception $e) { echo $e->getMessage(); } -echo "\n\nIncorrect number of args:\n"; -ReflectionProperty::export(); -ReflectionProperty::export('TestClass', "nonExistentProperty", true, false); - ?> --EXPECTF-- Non-existent class: @@ -52,13 +48,3 @@ Non-existent property: Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d Property TestClass::$nonExistentProperty does not exist - -Incorrect number of args: - -Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d - -Warning: ReflectionProperty::export() expects at least 2 parameters, 0 given in %s on line %d - -Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d - -Warning: ReflectionProperty::export() expects at most 3 parameters, 4 given in %s on line %d diff --git a/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt b/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt index c7c9366471..7ee787a348 100644 --- a/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt +++ b/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt @@ -13,15 +13,9 @@ class B extends A { $propInfo = new ReflectionProperty('B', 'prop'); var_dump($propInfo->getDeclaringClass()); -echo "Wrong number of params:\n"; -$propInfo->getDeclaringClass(1); - ?> --EXPECTF-- object(ReflectionClass)#%d (1) { ["name"]=> string(1) "A" } -Wrong number of params: - -Warning: ReflectionProperty::getDeclaringClass() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/reflection/tests/ReflectionProperty_getValue_error.phpt b/ext/reflection/tests/ReflectionProperty_getValue_error.phpt index 3bca85e4b6..2ffd244501 100644 --- a/ext/reflection/tests/ReflectionProperty_getValue_error.phpt +++ b/ext/reflection/tests/ReflectionProperty_getValue_error.phpt @@ -18,24 +18,12 @@ $instance = new TestClass(); $invalidInstance = new AnotherClass(); $propInfo = new ReflectionProperty('TestClass', 'pub2'); -echo "Too few args:\n"; -var_dump($propInfo->getValue()); - -echo "\nToo many args:\n"; -var_dump($propInfo->getValue($instance, true)); - -echo "\nWrong type of arg:\n"; -var_dump($propInfo->getValue(true)); - echo "\nInstance without property:\n"; $propInfo = new ReflectionProperty('TestClass', 'stat'); echo "\nStatic property / too many args:\n"; var_dump($propInfo->getValue($instance, true)); -echo "\nStatic property / wrong type of arg:\n"; -var_dump($propInfo->getValue(true)); - echo "\nProtected property:\n"; try { $propInfo = new ReflectionProperty('TestClass', 'prot'); @@ -51,36 +39,18 @@ var_dump($propInfo->getValue($invalidInstance)); ?> --EXPECTF-- -Too few args: - -Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Too many args: - -Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Wrong type of arg: - -Warning: ReflectionProperty::getValue() expects parameter 1 to be object, bool given in %s on line %d -NULL - Instance without property: Static property / too many args: string(15) "static property" -Static property / wrong type of arg: -string(15) "static property" - Protected property: Cannot access non-public member TestClass::$prot Invalid instance: -Fatal error: Uncaught ReflectionException: Given object is not an instance of the class this property was declared in in %s:47 +Fatal error: Uncaught ReflectionException: Given object is not an instance of the class this property was declared in in %s:%d Stack trace: -#0 %s(47): ReflectionProperty->getValue(Object(AnotherClass)) +#0 %s(%d): ReflectionProperty->getValue(Object(AnotherClass)) #1 {main} - thrown in %s on line 47 + thrown in %s on line %d diff --git a/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt b/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt index 2aa630d9d0..1472615178 100644 --- a/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt +++ b/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt @@ -24,10 +24,6 @@ reflectProperty("TestClass", "stat"); reflectProperty("TestClass", "prot"); reflectProperty("TestClass", "priv"); -echo "Wrong number of params:\n"; -$propInfo = new ReflectionProperty('TestClass', 'pub'); -$propInfo->isDefault(1); - ?> --EXPECTF-- ********************************** @@ -58,6 +54,3 @@ isDefault(): bool(true) ********************************** -Wrong number of params: - -Warning: ReflectionProperty::isDefault() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/reflection/tests/ReflectionProperty_setValue_error.phpt b/ext/reflection/tests/ReflectionProperty_setValue_error.phpt index 0bf223daa7..f58590b3ea 100644 --- a/ext/reflection/tests/ReflectionProperty_setValue_error.phpt +++ b/ext/reflection/tests/ReflectionProperty_setValue_error.phpt @@ -18,30 +18,6 @@ $instance = new TestClass(); $instanceWithNoProperties = new AnotherClass(); $propInfo = new ReflectionProperty('TestClass', 'pub2'); -echo "Too few args:\n"; -var_dump($propInfo->setValue()); -var_dump($propInfo->setValue($instance)); - -echo "\nToo many args:\n"; -var_dump($propInfo->setValue($instance, "NewValue", true)); - -echo "\nWrong type of arg:\n"; -var_dump($propInfo->setValue(true, "NewValue")); -$propInfo = new ReflectionProperty('TestClass', 'stat'); - -echo "\nStatic property / too many args:\n"; -var_dump($propInfo->setValue($instance, "NewValue", true)); - -echo "\nStatic property / too few args:\n"; -var_dump($propInfo->setValue("A new value")); -var_dump(TestClass::$stat); -var_dump($propInfo->setValue()); -var_dump(TestClass::$stat); - -echo "\nStatic property / wrong type of arg:\n"; -var_dump($propInfo->setValue(true, "Another new value")); -var_dump(TestClass::$stat); - echo "\nProtected property:\n"; try { $propInfo = new ReflectionProperty('TestClass', 'prot'); @@ -57,41 +33,6 @@ var_dump($propInfo->setValue($instanceWithNoProperties, "NewValue")); var_dump($instanceWithNoProperties->pub2); ?> --EXPECTF-- -Too few args: - -Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Too many args: - -Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Wrong type of arg: - -Warning: ReflectionProperty::setValue() expects parameter 1 to be object, bool given in %s on line %d -NULL - -Static property / too many args: - -Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Static property / too few args: -NULL -string(11) "A new value" - -Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 0 given in %s on line %d -NULL -string(11) "A new value" - -Static property / wrong type of arg: -NULL -string(17) "Another new value" - Protected property: Cannot access non-public member TestClass::$prot diff --git a/ext/reflection/tests/ReflectionProperty_typed_static.phpt b/ext/reflection/tests/ReflectionProperty_typed_static.phpt index 77f95d77ef..eaf4209644 100644 --- a/ext/reflection/tests/ReflectionProperty_typed_static.phpt +++ b/ext/reflection/tests/ReflectionProperty_typed_static.phpt @@ -45,7 +45,7 @@ var_dump($rp->getValue()); int(42) Typed static property Test::$y must not be accessed before initialization int(24) -Typed property Test::$y must be int, string used +Cannot assign string to property Test::$y of type int int(24) Cannot assign string to reference held by property Test::$y of type int int(24) diff --git a/ext/reflection/tests/bug26695.phpt b/ext/reflection/tests/bug26695.phpt index e429f766e9..ab61ee929f 100644 --- a/ext/reflection/tests/bug26695.phpt +++ b/ext/reflection/tests/bug26695.phpt @@ -19,7 +19,5 @@ $class = $params[0]->getClass(); var_dump($class->getName()); ?> -===DONE=== --EXPECT-- string(3) "Foo" -===DONE=== diff --git a/ext/reflection/tests/bug29828.phpt b/ext/reflection/tests/bug29828.phpt index 43e32d2116..a5f3e30c6f 100644 --- a/ext/reflection/tests/bug29828.phpt +++ b/ext/reflection/tests/bug29828.phpt @@ -26,10 +26,8 @@ $o=new BlaMore; $o->bla(); ?> -===DONE=== --EXPECT-- int(1) bool(false) bool(false) Hello -===DONE=== diff --git a/ext/reflection/tests/bug30146.phpt b/ext/reflection/tests/bug30146.phpt index 3f621414f1..d2e54324a7 100644 --- a/ext/reflection/tests/bug30146.phpt +++ b/ext/reflection/tests/bug30146.phpt @@ -15,9 +15,7 @@ var_dump($r->getValue()); $r->setValue(3); var_dump($r->getValue()); ?> -===DONE=== --EXPECT-- int(1) int(2) int(3) -===DONE=== diff --git a/ext/reflection/tests/bug30148.phpt b/ext/reflection/tests/bug30148.phpt deleted file mode 100644 index 27c31ca6ae..0000000000 --- a/ext/reflection/tests/bug30148.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -Reflection Bug #30148 (ReflectionMethod->isConstructor() fails for inherited classes) ---FILE-- -<?php - -class Root -{ - function Root() {} -} -class Base extends Root -{ - function __construct() {} -} -class Derived extends Base -{ -} -$a = new ReflectionMethod('Root','Root'); -$b = new ReflectionMethod('Base','Root'); -$c = new ReflectionMethod('Base','__construct'); -$d = new ReflectionMethod('Derived','Root'); -$e = new ReflectionMethod('Derived','__construct'); -var_dump($a->isConstructor()); -var_dump($b->isConstructor()); -var_dump($c->isConstructor()); -var_dump($d->isConstructor()); -var_dump($e->isConstructor()); -?> -===DONE=== ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Root has a deprecated constructor in %s on line %d -bool(true) -bool(false) -bool(true) -bool(false) -bool(true) -===DONE=== diff --git a/ext/reflection/tests/bug30209.phpt b/ext/reflection/tests/bug30209.phpt index bc1f6c7e86..27b546d1cd 100644 --- a/ext/reflection/tests/bug30209.phpt +++ b/ext/reflection/tests/bug30209.phpt @@ -24,8 +24,6 @@ class Foo $foo = new Foo; $foo->testBAR(); ?> -===DONE=== --EXPECT-- string(7) "testBAR" string(7) "testBAR" -===DONE=== diff --git a/ext/reflection/tests/bug30856.phpt b/ext/reflection/tests/bug30856.phpt index 39fc1104ab..23d50b17a7 100644 --- a/ext/reflection/tests/bug30856.phpt +++ b/ext/reflection/tests/bug30856.phpt @@ -11,10 +11,8 @@ $class = new ReflectionClass('bogus'); var_dump($class->getStaticProperties()); ?> -===DONE=== --EXPECT-- array(1) { ["a"]=> string(4) "test" } -===DONE=== diff --git a/ext/reflection/tests/bug32981.phpt b/ext/reflection/tests/bug32981.phpt index 5735674585..0e3b721a64 100644 --- a/ext/reflection/tests/bug32981.phpt +++ b/ext/reflection/tests/bug32981.phpt @@ -21,7 +21,6 @@ foreach ($class->getMethods() as $method) var_dump($arr_static_vars); ?> -===DONE=== --EXPECT-- string(4) "test" array(1) { @@ -31,4 +30,3 @@ array(1) { bool(true) } } -===DONE=== diff --git a/ext/reflection/tests/bug37816.phpt b/ext/reflection/tests/bug37816.phpt index 89ca3238b6..3942265a0e 100644 --- a/ext/reflection/tests/bug37816.phpt +++ b/ext/reflection/tests/bug37816.phpt @@ -22,7 +22,5 @@ catch (Exception $e) } ?> -===DONE=== --EXPECT-- Caught: Cannot access non-public member TestClass::$p -===DONE=== diff --git a/ext/reflection/tests/bug38942.phpt b/ext/reflection/tests/bug38942.phpt deleted file mode 100644 index 6dbe396ae6..0000000000 --- a/ext/reflection/tests/bug38942.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -Bug #38942 (Double old-style-ctor inheritance) ---FILE-- -<?php -class foo { - public function foo() {} -} - -class bar extends foo { -} -echo new ReflectionClass("bar"); -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in %s on line %d -Class [ <user> class bar extends foo ] { - @@ %sbug38942.php 6-7 - - - Constants [0] { - } - - - Static properties [0] { - } - - - Static methods [0] { - } - - - Properties [0] { - } - - - Methods [1] { - Method [ <user, inherits foo, ctor> public method foo ] { - @@ %sbug38942.php 3 - 3 - } - } -} diff --git a/ext/reflection/tests/bug41061.phpt b/ext/reflection/tests/bug41061.phpt index 027b872be9..df807566db 100644 --- a/ext/reflection/tests/bug41061.phpt +++ b/ext/reflection/tests/bug41061.phpt @@ -14,8 +14,6 @@ class bar { echo new ReflectionFunction('foo'), "\n"; echo new ReflectionMethod('bar', 'foo'), "\n"; ?> -===DONE=== -<?php exit(0); ?> --EXPECTF-- Function [ <user> function foo ] { @@ %sbug41061.php 3 - 4 @@ -25,4 +23,3 @@ Method [ <user> private method foo ] { @@ %sbug41061.php 7 - 8 } -===DONE=== diff --git a/ext/reflection/tests/bug46064.phpt b/ext/reflection/tests/bug46064.phpt index d8ee411905..f11de98733 100644 --- a/ext/reflection/tests/bug46064.phpt +++ b/ext/reflection/tests/bug46064.phpt @@ -45,7 +45,6 @@ class bar extends test { new bar; ?> -===DONE=== --EXPECTF-- object(ReflectionProperty)#%d (2) { ["name"]=> @@ -73,4 +72,3 @@ object(ReflectionProperty)#%d (2) { int(2) bool(false) bool(true) -===DONE=== diff --git a/ext/reflection/tests/bug46064_2.phpt b/ext/reflection/tests/bug46064_2.phpt index 65afa836b7..9e10167d30 100644 --- a/ext/reflection/tests/bug46064_2.phpt +++ b/ext/reflection/tests/bug46064_2.phpt @@ -36,7 +36,6 @@ class test extends bar { new test; ?> -===DONE=== --EXPECTF-- object(ReflectionProperty)#%d (2) { ["name"]=> @@ -71,4 +70,3 @@ array(2) { string(4) "test" } } -===DONE=== diff --git a/ext/reflection/tests/bug47254.phpt b/ext/reflection/tests/bug47254.phpt index e3ce114c9c..b6f33fcfc6 100644 --- a/ext/reflection/tests/bug47254.phpt +++ b/ext/reflection/tests/bug47254.phpt @@ -23,10 +23,7 @@ $m = $R->getMethods(); print_r($m); ?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in %s on line %d +--EXPECT-- Array ( [0] => ReflectionMethod Object diff --git a/ext/reflection/tests/bug53366.phpt b/ext/reflection/tests/bug53366.phpt index 5fb119d820..61493d5302 100644 --- a/ext/reflection/tests/bug53366.phpt +++ b/ext/reflection/tests/bug53366.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #53366 (Reflection doesnt get dynamic property value from getProperty()) +Bug #53366 (Reflection doesn't get dynamic property value from getProperty()) --FILE-- <?php diff --git a/ext/reflection/tests/bug64936.phpt b/ext/reflection/tests/bug64936.phpt index c3e781805e..71be47f65b 100644 --- a/ext/reflection/tests/bug64936.phpt +++ b/ext/reflection/tests/bug64936.phpt @@ -28,8 +28,6 @@ $rb = new ReflectionClass('B'); var_dump(strip_doc_comment($rb->getDocComment())); ?> -===DONE=== --EXPECT-- bool(false) bool(false) -===DONE=== diff --git a/ext/reflection/tests/bug72661.phpt b/ext/reflection/tests/bug72661.phpt index 46ba048078..b1cb764beb 100644 --- a/ext/reflection/tests/bug72661.phpt +++ b/ext/reflection/tests/bug72661.phpt @@ -6,6 +6,5 @@ function test(iterable $arg) { } var_dump((string)(new ReflectionParameter("test", 0))->getType()); ?> ---EXPECTF-- -Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d +--EXPECT-- string(8) "iterable" diff --git a/ext/reflection/tests/bug74454.phpt b/ext/reflection/tests/bug74454.phpt index 9e0332d893..0c85baa7c3 100644 --- a/ext/reflection/tests/bug74454.phpt +++ b/ext/reflection/tests/bug74454.phpt @@ -13,7 +13,5 @@ function load_file() { require __DIR__ . '/bug74454.inc'; } ?> -===DONE=== --EXPECT-- ParseError: syntax error, unexpected 'if' (T_IF), expecting function (T_FUNCTION) or const (T_CONST) -===DONE=== diff --git a/ext/reflection/tests/bug74673.phpt b/ext/reflection/tests/bug74673.phpt index 47f7604e8b..42675f263e 100644 --- a/ext/reflection/tests/bug74673.phpt +++ b/ext/reflection/tests/bug74673.phpt @@ -3,10 +3,6 @@ Bug #74673 (Segfault when cast Reflection object to string with undefined consta --FILE-- <?php -set_error_handler(function() { - throw new Exception(); -}); - class A { public function method($test = PHP_SELF + 1) @@ -19,9 +15,8 @@ $class = new ReflectionClass('A'); echo $class; ?> --EXPECTF-- -Fatal error: Uncaught Exception in %s:%d +Fatal error: Uncaught Error: Undefined constant 'PHP_SELF' in %s:%d Stack trace: -#0 [internal function]: {closure}(2, 'Use of undefine...', %s, %d, Array) -#1 %s(%d): ReflectionClass->__toString() -#2 {main} +#0 %s(%d): ReflectionClass->__toString() +#1 {main} thrown in %s on line %d diff --git a/ext/reflection/tests/bug76536.phpt b/ext/reflection/tests/bug76536.phpt index 9f3b3fdb31..aa32781e16 100644 --- a/ext/reflection/tests/bug76536.phpt +++ b/ext/reflection/tests/bug76536.phpt @@ -2,7 +2,7 @@ Bug #76536 (PHP crashes with core dump when throwing exception in error handler) --FILE-- <?php -class SomeConstants {const SOME_CONSTANT = SOME_NONSENSE;} +class SomeConstants {const SOME_CONSTANT = "foo" % 5; } function handleError() {throw new ErrorException();} diff --git a/ext/reflection/tests/closures_001.phpt b/ext/reflection/tests/closures_001.phpt index 57c1b4e3f6..926951eef2 100644 --- a/ext/reflection/tests/closures_001.phpt +++ b/ext/reflection/tests/closures_001.phpt @@ -47,7 +47,6 @@ $rp = new ReflectionParameter($closure, 'b'); var_dump($rp->isOptional()); ?> -===DONE=== --EXPECT-- int(2) int(1) @@ -67,4 +66,3 @@ bool(false) bool(true) bool(false) bool(true) -===DONE=== diff --git a/ext/reflection/tests/closures_002.phpt b/ext/reflection/tests/closures_002.phpt index ed973b56c1..27683bcf2b 100644 --- a/ext/reflection/tests/closures_002.phpt +++ b/ext/reflection/tests/closures_002.phpt @@ -19,11 +19,9 @@ $rp = new ReflectionParameter(array(new Test, '__invoke'), 1); var_dump($rp->isOptional()); ?> -===DONE=== --EXPECT-- string(8) "__invoke" int(2) int(1) bool(false) bool(true) -===DONE=== diff --git a/ext/reflection/tests/closures_003.phpt b/ext/reflection/tests/closures_003.phpt index 57245cacde..e50d9c466f 100644 --- a/ext/reflection/tests/closures_003.phpt +++ b/ext/reflection/tests/closures_003.phpt @@ -18,8 +18,6 @@ unset ($parameter); echo $method->getName ()."\n"; ?> -===DONE=== --EXPECT-- __invoke __invoke -===DONE=== diff --git a/ext/reflection/tests/closures_003_v1.phpt b/ext/reflection/tests/closures_003_v1.phpt index cf853a00fd..1ae5502a39 100644 --- a/ext/reflection/tests/closures_003_v1.phpt +++ b/ext/reflection/tests/closures_003_v1.phpt @@ -18,8 +18,6 @@ unset ($parameter); echo $method->getName ()."\n"; ?> -===DONE=== --EXPECT-- {closure} {closure} -===DONE=== diff --git a/ext/reflection/tests/closures_004.phpt b/ext/reflection/tests/closures_004.phpt index e2b52c5429..479c7c3e67 100644 --- a/ext/reflection/tests/closures_004.phpt +++ b/ext/reflection/tests/closures_004.phpt @@ -30,7 +30,6 @@ $closure2 (); $closure2->__invoke (); ?> -===DONE=== --EXPECT-- Invoked! Invoked! @@ -40,4 +39,3 @@ Invoked! Invoked! Invoked! Invoked! -===DONE=== diff --git a/ext/reflection/tests/parameters_001.phpt b/ext/reflection/tests/parameters_001.phpt index 972b97c1c7..92869a2faf 100644 --- a/ext/reflection/tests/parameters_001.phpt +++ b/ext/reflection/tests/parameters_001.phpt @@ -28,11 +28,9 @@ catch (Exception $e) { } ?> -===DONE=== --EXPECT-- int(2) int(1) bool(false) bool(true) string(54) "The parameter specified by its name could not be found" -===DONE=== diff --git a/ext/reflection/tests/parameters_002.phpt b/ext/reflection/tests/parameters_002.phpt index ae924323a0..aed8d7afa0 100644 --- a/ext/reflection/tests/parameters_002.phpt +++ b/ext/reflection/tests/parameters_002.phpt @@ -72,8 +72,6 @@ check_params(new ReflectionFunction('test')); check_params(new ReflectionMethod('test::method')); ?> -===DONE=== -<?php exit(0); ?> --EXPECT-- #####test()##### ===0=== @@ -207,4 +205,3 @@ allowsNull: bool(true) isOptional: bool(true) isDefaultValueAvailable: bool(true) getDefaultValue: string(6) "FooBar" -===DONE=== diff --git a/ext/reflection/tests/property_exists.phpt b/ext/reflection/tests/property_exists.phpt index d7ecefb775..002ece12b3 100644 --- a/ext/reflection/tests/property_exists.phpt +++ b/ext/reflection/tests/property_exists.phpt @@ -90,8 +90,6 @@ var_dump(property_exists(new A, '123')); var_dump(property_exists(new A, 'init')); var_dump(property_exists(new A, 'empty')); ?> -===DONE=== -<?php exit(0); ?> --EXPECTF-- ===A=== obj(A)::$a @@ -219,4 +217,3 @@ bool(false) bool(false) bool(true) bool(true) -===DONE=== diff --git a/ext/reflection/tests/request38992.phpt b/ext/reflection/tests/request38992.phpt index 8c0052fd85..e6eab83415 100644 --- a/ext/reflection/tests/request38992.phpt +++ b/ext/reflection/tests/request38992.phpt @@ -11,12 +11,17 @@ class MyClass } $r = new ReflectionMethod('MyClass', 'doSomething'); -$r->invoke('WTF?'); -$r->invokeArgs('WTF?', array()); +try { + $r->invoke('WTF?'); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + $r->invokeArgs('WTF?', array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> -===DONE=== ---EXPECTF-- -Warning: ReflectionMethod::invoke() expects parameter 1 to be object, string given in %s%erequest38992.php on line %d - -Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, string given in %s%erequest38992.php on line %d -===DONE=== +--EXPECT-- +ReflectionMethod::invoke() expects parameter 1 to be object, string given +ReflectionMethod::invokeArgs() expects parameter 1 to be object, string given diff --git a/ext/reflection/tests/union_types.phpt b/ext/reflection/tests/union_types.phpt new file mode 100644 index 0000000000..bb568a0cf4 --- /dev/null +++ b/ext/reflection/tests/union_types.phpt @@ -0,0 +1,112 @@ +--TEST-- +Union types in reflection +--INI-- +error_reporting=E_ALL&~E_DEPRECATED +--FILE-- +<?php + +function dumpType(ReflectionUnionType $rt) { + echo "Type $rt:\n"; + echo "Allows null: " . ($rt->allowsNull() ? "true" : "false") . "\n"; + foreach ($rt->getTypes() as $type) { + echo " Name: " . $type->getName() . "\n"; + echo " String: " . (string) $type . "\n"; + echo " Allows Null: " . ($type->allowsNull() ? "true" : "false") . "\n"; + } +} + +function test1(): X|Y|int|float|false|null { } +function test2(): X|iterable|bool { } + +class Test { + public X|Y|int $prop; +} + +dumpType((new ReflectionFunction('test1'))->getReturnType()); +dumpType((new ReflectionFunction('test2'))->getReturnType()); + +$rc = new ReflectionClass(Test::class); +$rp = $rc->getProperty('prop'); +dumpType($rp->getType()); + +/* Force CE resolution of the property type */ + +class x {} +$test = new Test; +$test->prop = new x; + +$rp = $rc->getProperty('prop'); +dumpType($rp->getType()); + +class y {} +$test->prop = new y; + +$rp = $rc->getProperty('prop'); +dumpType($rp->getType()); + +?> +--EXPECT-- +Type X|Y|int|float|false|null: +Allows null: true + Name: X + String: X + Allows Null: false + Name: Y + String: Y + Allows Null: false + Name: int + String: int + Allows Null: false + Name: float + String: float + Allows Null: false + Name: false + String: false + Allows Null: false + Name: null + String: null + Allows Null: true +Type X|iterable|bool: +Allows null: false + Name: X + String: X + Allows Null: false + Name: iterable + String: iterable + Allows Null: false + Name: bool + String: bool + Allows Null: false +Type X|Y|int: +Allows null: false + Name: X + String: X + Allows Null: false + Name: Y + String: Y + Allows Null: false + Name: int + String: int + Allows Null: false +Type x|Y|int: +Allows null: false + Name: x + String: x + Allows Null: false + Name: Y + String: Y + Allows Null: false + Name: int + String: int + Allows Null: false +Type x|y|int: +Allows null: false + Name: x + String: x + Allows Null: false + Name: y + String: y + Allows Null: false + Name: int + String: int + Allows Null: false |
