@@ -850,24 +850,32 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry
850
850
}
851
851
if (closure ) {
852
852
const zend_function * closure_fptr = zend_get_closure_method_def (closure TSRMLS_CC );
853
+ zval * closure_this = zend_get_closure_this_ptr (closure TSRMLS_CC );
854
+ HashTable * static_variables = NULL ;
855
+ int index = 0 , count = closure_this ? 1 : 0 ;
853
856
if (closure_fptr -> type == ZEND_USER_FUNCTION && closure_fptr -> op_array .static_variables ) {
854
- HashTable * static_variables = closure_fptr -> op_array .static_variables ;
855
- HashPosition pos ;
856
- uint key_len ;
857
- char * key ;
858
- ulong num_index , index = 0 ;
859
- int count = zend_hash_num_elements (static_variables );
860
- if (count ) {
861
- string_printf (str , "\n" );
862
- string_printf (str , "%s - Static Parameters [%d] {\n" , indent , count );
857
+ static_variables = closure_fptr -> op_array .static_variables ;
858
+ count += zend_hash_num_elements (static_variables );
859
+ }
860
+ if (count ) {
861
+ string_printf (str , "\n" );
862
+ string_printf (str , "%s - Static Parameters [%d] {\n" , indent , count );
863
+ if (closure_this ) {
864
+ string_printf (str , "%s Parameter #%d [ %s $this ]\n" , indent , ++ index , Z_OBJCE_P (closure_this )-> name );
865
+ }
866
+ if (static_variables ) {
867
+ HashPosition pos ;
868
+ uint key_len ;
869
+ char * key ;
870
+ ulong num_index ;
863
871
zend_hash_internal_pointer_reset_ex (static_variables , & pos );
864
872
while (index ++ < count ) {
865
873
zend_hash_get_current_key_ex (static_variables , & key , & key_len , & num_index , 0 , & pos );
866
874
string_printf (str , "%s Parameter #%d [ $%s ]\n" , indent , index ++ , key );
867
875
zend_hash_move_forward_ex (static_variables , & pos );
868
- }
869
- string_printf (str , "%s }\n" , indent );
876
+ }
870
877
}
878
+ string_printf (str , "%s }\n" , indent );
871
879
}
872
880
}
873
881
string_init (& param_indent );
0 commit comments