summaryrefslogtreecommitdiff
path: root/ext/reflection/php_reflection.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r--ext/reflection/php_reflection.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 82d76457da..df15efd077 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -3037,6 +3037,14 @@ ZEND_METHOD(reflection_type, __toString)
str = reflection_type_name(param);
+ if (param->arg_info->type_hint == IS_OBJECT
+ && !zend_string_equals_literal_ci(param->arg_info->class_name, "self")
+ && !zend_string_equals_literal_ci(param->arg_info->class_name, "parent")) {
+ str = zend_string_extend(str, ZSTR_LEN(str) + 1, 0);
+ memmove(ZSTR_VAL(str) + 1, ZSTR_VAL(str), ZSTR_LEN(str) + 1);
+ ZSTR_VAL(str)[0] = '\\';
+ }
+
if (param->arg_info->allow_null) {
str = zend_string_extend(str, ZSTR_LEN(str) + 1, 0);
memmove(ZSTR_VAL(str) + 1, ZSTR_VAL(str), ZSTR_LEN(str) + 1);