ReflectionFunction::invoke($arg = null, ...$args)
ReflectionMethod::invoke($object, $arg = null, ...$args)
+ . The ReflectionType::__toString() method will now return a complete debug
+ representation of the type, and is no longer deprecated. In particular the
+ result will include a nullability indicator for nullable types. The format
+ of the return value is not stable and may change between PHP versions.
+
- Socket:
. The deprecated AI_IDN_ALLOW_UNASSIGNED and AI_IDN_USE_STD3_ASCII_RULES
flags for socket_addrinfo_lookup() have been removed.
--TEST--
Bug #78239: Deprecation notice during string conversion converted to exception hangs
+--SKIPIF--
+<?php if (!extension_loaded("zend-test")) die("skip requires zend-test extension"); ?>
--FILE--
<?php
function handleError($level, $message, $file = '', $line = 0, $context = [])
set_error_handler('handleError');
-class A
-{
-
- public function abc(): bool
- {
- return false;
- }
-}
-
-$r = new ReflectionMethod("A", "abc");
-(string)$r->getReturnType() ?: "";
+$r = new _ZendTestClass;
+(string)$r ?: "";
?>
--EXPECTF--
-Fatal error: Uncaught ErrorException: Function ReflectionType::__toString() is deprecated in %s:%d
+Fatal error: Uncaught ErrorException: Function _ZendTestClass::__toString() is deprecated in %s:%d
Stack trace:
#0 %s(%d): handleError(%s)
#1 {main}
}
GET_REFLECTION_OBJECT_PTR(param);
- RETURN_STR(zend_type_to_string(ZEND_TYPE_WITHOUT_NULL(param->type)));
+ RETURN_STR(zend_type_to_string(param->type));
}
/* }}} */
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, __toString, arginfo_reflection__void, ZEND_ACC_DEPRECATED)
+ ZEND_ME(reflection_type, __toString, arginfo_reflection__void, 0)
PHP_FE_END
};
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"
var_dump((string)(new ReflectionParameter("test", 0))->getType());
?>
---EXPECTF--
-Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
+--EXPECT--
string(8) "iterable"
}
/* }}} */
+static ZEND_METHOD(_ZendTestClass, __toString) /* {{{ */ {
+ RETURN_EMPTY_STRING();
+}
+/* }}} */
+
static ZEND_METHOD(_ZendTestTrait, testMethod) /* {{{ */ {
RETURN_TRUE;
}
/* }}} */
+static const zend_function_entry zend_test_class_methods[] = {
+ ZEND_ME(_ZendTestClass, __toString, NULL, ZEND_ACC_DEPRECATED)
+ ZEND_FE_END
+};
+
static const zend_function_entry zend_test_trait_methods[] = {
ZEND_ME(_ZendTestTrait, testMethod, NULL, ZEND_ACC_PUBLIC)
ZEND_FE_END
INIT_CLASS_ENTRY(class_entry, "_ZendTestInterface", NULL);
zend_test_interface = zend_register_internal_interface(&class_entry);
zend_declare_class_constant_long(zend_test_interface, ZEND_STRL("DUMMY"), 0);
- INIT_CLASS_ENTRY(class_entry, "_ZendTestClass", NULL);
- zend_test_class = zend_register_internal_class_ex(&class_entry, NULL);
+ INIT_CLASS_ENTRY(class_entry, "_ZendTestClass", zend_test_class_methods);
+ zend_test_class = zend_register_internal_class(&class_entry);
zend_class_implements(zend_test_class, 1, zend_test_interface);
zend_test_class->create_object = zend_test_class_new;
zend_test_class->get_static_method = zend_test_class_static_method_get;