@@ -2799,6 +2799,7 @@ ZEND_METHOD(reflection_type, __toString)
2799
2799
{
2800
2800
reflection_object * intern ;
2801
2801
type_reference * param ;
2802
+ zend_string * class_name ;
2802
2803
2803
2804
if (zend_parse_parameters_none () == FAILURE ) {
2804
2805
return ;
@@ -2810,9 +2811,24 @@ ZEND_METHOD(reflection_type, __toString)
2810
2811
case IS_CALLABLE : RETURN_STRINGL ("callable" , sizeof ("callable" ) - 1 );
2811
2812
case IS_OBJECT :
2812
2813
if (param -> fptr -> type == ZEND_INTERNAL_FUNCTION ) {
2813
- RETURN_STRING (((zend_internal_arg_info * )param -> arg_info )-> class_name );
2814
+ const char * name = ((zend_internal_arg_info * )param -> arg_info )-> class_name ;
2815
+
2816
+ class_name = zend_string_init (name , strlen (name ), 0 );
2817
+ } else {
2818
+ class_name = zend_string_copy (param -> arg_info -> class_name );
2819
+ }
2820
+
2821
+ if (param -> fptr -> common .scope ) {
2822
+ if (zend_string_equals_literal_ci (class_name , "self" )) {
2823
+ zend_string_release (class_name );
2824
+ class_name = zend_string_copy (param -> fptr -> common .scope -> name );
2825
+ } else if (zend_string_equals_literal_ci (class_name , "parent" )) {
2826
+ zend_string_release (class_name );
2827
+ class_name = zend_string_copy (param -> fptr -> common .scope -> parent -> name );
2828
+ }
2814
2829
}
2815
- RETURN_STR (zend_string_copy (param -> arg_info -> class_name ));
2830
+
2831
+ RETURN_STR (class_name );
2816
2832
case IS_STRING : RETURN_STRINGL ("string" , sizeof ("string" ) - 1 );
2817
2833
case _IS_BOOL : RETURN_STRINGL ("bool" , sizeof ("bool" ) - 1 );
2818
2834
case IS_LONG : RETURN_STRINGL ("int" , sizeof ("int" ) - 1 );
0 commit comments