summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/reflection/php_reflection.c9
-rw-r--r--ext/reflection/tests/ReflectionClass_export_basic2.phpt11
2 files changed, 15 insertions, 5 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index e3d16fd3e0..018f97e462 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -595,7 +595,8 @@ static void _parameter_string(smart_str *str, zend_function *fptr, struct _zend_
}
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));
+ smart_str_append(str, type_str);
+ smart_str_appendc(str, ' ');
zend_string_release(type_str);
}
if (ZEND_ARG_SEND_MODE(arg_info)) {
@@ -843,6 +844,12 @@ static void _property_string(smart_str *str, zend_property_info *prop, const cha
if (prop->flags & ZEND_ACC_STATIC) {
smart_str_appends(str, "static ");
}
+ if (ZEND_TYPE_IS_SET(prop->type)) {
+ zend_string *type_str = zend_type_to_string(prop->type);
+ smart_str_append(str, type_str);
+ smart_str_appendc(str, ' ');
+ zend_string_release(type_str);
+ }
if (!prop_name) {
const char *class_name;
zend_unmangle_property_name(prop->name, &class_name, &prop_name);
diff --git a/ext/reflection/tests/ReflectionClass_export_basic2.phpt b/ext/reflection/tests/ReflectionClass_export_basic2.phpt
index c91c5d1d73..6f3c54c88a 100644
--- a/ext/reflection/tests/ReflectionClass_export_basic2.phpt
+++ b/ext/reflection/tests/ReflectionClass_export_basic2.phpt
@@ -5,6 +5,7 @@ ReflectionClass::__toString() - ensure inherited private props are hidden.
Class c {
private $a;
static private $b;
+ public ?int $c = 42;
}
class d extends c {}
@@ -14,7 +15,7 @@ echo new ReflectionClass("d"), "\n";
?>
--EXPECTF--
Class [ <user> class c ] {
- @@ %s 2-5
+ @@ %s 2-6
- Constants [0] {
}
@@ -26,8 +27,9 @@ Class [ <user> class c ] {
- Static methods [0] {
}
- - Properties [1] {
+ - Properties [2] {
Property [ <default> private $a ]
+ Property [ <default> public ?int $c ]
}
- Methods [0] {
@@ -35,7 +37,7 @@ Class [ <user> class c ] {
}
Class [ <user> class d extends c ] {
- @@ %s 7-7
+ @@ %s 8-8
- Constants [0] {
}
@@ -46,7 +48,8 @@ Class [ <user> class d extends c ] {
- Static methods [0] {
}
- - Properties [0] {
+ - Properties [1] {
+ Property [ <default> public ?int $c ]
}
- Methods [0] {