summaryrefslogtreecommitdiff
path: root/ext/reflection
diff options
context:
space:
mode:
Diffstat (limited to 'ext/reflection')
-rw-r--r--ext/reflection/php_reflection.c150
-rw-r--r--ext/reflection/php_reflection.h2
-rw-r--r--ext/reflection/tests/004.phpt12
-rw-r--r--ext/reflection/tests/ReflectionClass_constructor_002.phpt19
-rw-r--r--ext/reflection/tests/ReflectionClass_export_basic1.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_getConstant_error.phpt18
-rw-r--r--ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt60
-rw-r--r--ext/reflection/tests/ReflectionClass_getMethod_002.phpt26
-rw-r--r--ext/reflection/tests/ReflectionClass_getParentClass.phpt7
-rw-r--r--ext/reflection/tests/ReflectionClass_getParentClass_001.phpt38
-rw-r--r--ext/reflection/tests/ReflectionClass_getProperty_002.phpt26
-rw-r--r--ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt19
-rw-r--r--ext/reflection/tests/ReflectionClass_hasConstant_002.phpt18
-rw-r--r--ext/reflection/tests/ReflectionClass_hasMethod_002.phpt18
-rw-r--r--ext/reflection/tests/ReflectionClass_hasProperty_002.phpt16
-rw-r--r--ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt12
-rw-r--r--ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt29
-rw-r--r--ext/reflection/tests/ReflectionClass_isIterateable_001.phpt37
-rw-r--r--ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt14
-rw-r--r--ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt25
-rw-r--r--ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_newInstance_001.phpt19
-rw-r--r--ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt25
-rw-r--r--ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt2
-rw-r--r--ext/reflection/tests/ReflectionClass_toString_001.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_bug66218.phpt1
-rw-r--r--ext/reflection/tests/ReflectionMethod_006.phpt74
-rw-r--r--ext/reflection/tests/ReflectionMethod_constructor_basic.phpt70
-rw-r--r--ext/reflection/tests/ReflectionMethod_getClosure_error.phpt25
-rw-r--r--ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt10
-rw-r--r--ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt2
-rw-r--r--ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt32
-rw-r--r--ext/reflection/tests/ReflectionMethod_invoke_basic.phpt20
-rw-r--r--ext/reflection/tests/ReflectionMethod_invoke_error1.phpt6
-rw-r--r--ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt38
-rw-r--r--ext/reflection/tests/ReflectionObject_getName_basic.phpt4
-rw-r--r--ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt37
-rw-r--r--ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt14
-rw-r--r--ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt14
-rw-r--r--ext/reflection/tests/ReflectionParameter_003.phpt2
-rw-r--r--ext/reflection/tests/ReflectionProperty_error.phpt33
-rw-r--r--ext/reflection/tests/ReflectionProperty_export_error.phpt14
-rw-r--r--ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt6
-rw-r--r--ext/reflection/tests/ReflectionProperty_getValue_error.phpt30
-rw-r--r--ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt7
-rw-r--r--ext/reflection/tests/ReflectionProperty_setValue_error.phpt59
-rw-r--r--ext/reflection/tests/ReflectionProperty_typed_static.phpt2
-rw-r--r--ext/reflection/tests/bug30148.phpt36
-rw-r--r--ext/reflection/tests/bug38942.phpt35
-rw-r--r--ext/reflection/tests/bug47254.phpt5
-rw-r--r--ext/reflection/tests/bug74673.phpt11
-rw-r--r--ext/reflection/tests/bug76536.phpt2
-rw-r--r--ext/reflection/tests/request38992.phpt21
53 files changed, 195 insertions, 1017 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index e7df9bfa61..4e556b3cbc 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, |
@@ -246,9 +244,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);
@@ -445,7 +443,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char
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};
@@ -512,7 +510,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",
@@ -534,7 +532,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);
@@ -582,17 +580,10 @@ 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) {
smart_str_appendc(str, '&');
@@ -802,17 +793,10 @@ static void _function_string(smart_str *str, zend_function *fptr, zend_class_ent
smart_str_free(&param_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");
}
@@ -1808,7 +1792,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);
@@ -1871,7 +1855,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);
@@ -2386,9 +2370,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) {
@@ -2567,13 +2549,15 @@ ZEND_METHOD(reflection_parameter, isArray)
{
reflection_object *intern;
parameter_reference *param;
+ zend_type type;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_BOOL(ZEND_TYPE_CODE(param->arg_info->type) == IS_ARRAY);
+ type = ZEND_TYPE_WITHOUT_NULL(param->arg_info->type);
+ RETVAL_BOOL(ZEND_TYPE_MASK(type) == MAY_BE_ARRAY);
}
/* }}} */
@@ -2583,13 +2567,15 @@ ZEND_METHOD(reflection_parameter, isCallable)
{
reflection_object *intern;
parameter_reference *param;
+ zend_type type;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_BOOL(ZEND_TYPE_CODE(param->arg_info->type) == IS_CALLABLE);
+ type = ZEND_TYPE_WITHOUT_NULL(param->arg_info->type);
+ RETVAL_BOOL(ZEND_TYPE_MASK(type) == MAY_BE_CALLABLE);
}
/* }}} */
@@ -2605,7 +2591,8 @@ ZEND_METHOD(reflection_parameter, allowsNull)
}
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));
}
/* }}} */
@@ -2819,9 +2806,9 @@ ZEND_METHOD(reflection_type, allowsNull)
}
/* }}} */
-/* {{{ proto public bool ReflectionType::isBuiltin()
- Returns whether parameter is a builtin type */
-ZEND_METHOD(reflection_type, isBuiltin)
+/* {{{ proto public string ReflectionType::__toString()
+ Return the text of the type hint */
+ZEND_METHOD(reflection_type, __toString)
{
reflection_object *intern;
type_reference *param;
@@ -2831,26 +2818,13 @@ ZEND_METHOD(reflection_type, isBuiltin)
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_BOOL(ZEND_TYPE_IS_CODE(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);
- }
+ RETURN_STR(zend_type_to_string(ZEND_TYPE_WITHOUT_NULL(param->type)));
}
/* }}} */
-/* {{{ proto public string ReflectionType::__toString()
- Return the text of the type hint */
-ZEND_METHOD(reflection_type, __toString)
+/* {{{ proto public string ReflectionNamedType::getName()
+ Return the name of the type */
+ZEND_METHOD(reflection_named_type, getName)
{
reflection_object *intern;
type_reference *param;
@@ -2860,13 +2834,13 @@ ZEND_METHOD(reflection_type, __toString)
}
GET_REFLECTION_OBJECT_PTR(param);
- RETURN_STR(reflection_type_name(param));
+ RETURN_STR(zend_type_to_string(ZEND_TYPE_WITHOUT_NULL(param->type)));
}
/* }}} */
-/* {{{ proto public string ReflectionNamedType::getName()
- Return the text of the type hint */
-ZEND_METHOD(reflection_named_type, getName)
+/* {{{ proto public bool ReflectionNamedType::isBuiltin()
+ Returns whether type is a builtin type */
+ZEND_METHOD(reflection_named_type, isBuiltin)
{
reflection_object *intern;
type_reference *param;
@@ -2876,7 +2850,7 @@ ZEND_METHOD(reflection_named_type, getName)
}
GET_REFLECTION_OBJECT_PTR(param);
- RETURN_STR(reflection_type_name(param));
+ RETVAL_BOOL(ZEND_TYPE_IS_MASK(param->type));
}
/* }}} */
@@ -3154,7 +3128,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)
{
@@ -3727,7 +3701,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;
}
@@ -3839,7 +3813,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;
}
@@ -4156,7 +4130,6 @@ 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;
@@ -4170,12 +4143,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;
}
@@ -4205,7 +4175,7 @@ ZEND_METHOD(reflection_class, getProperty)
}
} 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)) {
+ if (zend_hash_exists(Z_OBJ_HT(intern->obj)->get_properties(Z_OBJ(intern->obj)), name)) {
zend_property_info property_info_tmp;
property_info_tmp.flags = ZEND_ACC_PUBLIC;
property_info_tmp.name = name;
@@ -4324,7 +4294,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);
@@ -4589,7 +4559,7 @@ ZEND_METHOD(reflection_class, isInstance)
}
/* }}} */
-/* {{{ 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)
{
@@ -5235,7 +5205,7 @@ 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;
}
}
@@ -5494,11 +5464,10 @@ ZEND_METHOD(reflection_property, isInitialized)
if (ref->prop.flags & 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;
@@ -5513,8 +5482,7 @@ ZEND_METHOD(reflection_property, isInitialized)
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);
@@ -6267,7 +6235,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_function___construct, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_function_invoke, 0, 0, 0)
- ZEND_ARG_INFO(0, args)
+ ZEND_ARG_VARIADIC_INFO(0, args)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO(arginfo_reflection_function_invokeArgs, 0)
@@ -6345,9 +6313,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_method___construct, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_method_invoke, 0)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_method_invoke, 0, 0, 1)
ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, args)
+ ZEND_ARG_VARIADIC_INFO(0, args)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO(arginfo_reflection_method_invokeArgs, 0)
@@ -6441,8 +6409,8 @@ 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_BEGIN_ARG_INFO_EX(arginfo_reflection_class_newInstance, 0, 0, 0)
+ ZEND_ARG_VARIADIC_INFO(0, args)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_newInstanceWithoutConstructor, 0)
@@ -6653,13 +6621,13 @@ static const zend_function_entry reflection_parameter_functions[] = {
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)
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, isBuiltin, arginfo_reflection__void, 0)
PHP_FE_END
};
@@ -6729,20 +6697,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);
}
}
/* }}} */
@@ -6799,6 +6766,7 @@ 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);
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/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/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_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_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_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_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_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_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_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_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 91398867ec..b0deab33da 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..11bd44077f 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,28 +27,17 @@ 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')));
-} 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) {
@@ -85,13 +69,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..9406c2e5d1 100644
--- a/ext/reflection/tests/ReflectionClass_toString_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_toString_001.phpt
@@ -265,7 +265,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
Method [ <internal:Reflection> public method newInstance ] {
- Parameters [1] {
- Parameter #0 [ <required> $args ]
+ Parameter #0 [ <optional> ...$args ]
}
}
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/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_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_error.phpt b/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt
index d3b9ca3c81..d1e7ee68fb 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 ) {
@@ -55,19 +47,6 @@ try {
--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/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/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..52e9d1d2ef 100644
--- a/ext/reflection/tests/ReflectionProperty_getValue_error.phpt
+++ b/ext/reflection/tests/ReflectionProperty_getValue_error.phpt
@@ -18,15 +18,6 @@ $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');
@@ -51,21 +42,6 @@ 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:
@@ -79,8 +55,8 @@ 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/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/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/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/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/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