@@ -904,6 +904,7 @@ PHP_METHOD(SoapFault, SoapFault)
904
904
PHP_METHOD (SoapFault , __toString )
905
905
{
906
906
zval * faultcode , * faultstring , * file , * line , * trace ;
907
+ zval * faultcode_cp , * faultstring_cp , * file_cp , * line_cp ;
907
908
char * str ;
908
909
int len ;
909
910
zend_fcall_info fci ;
@@ -932,16 +933,36 @@ PHP_METHOD(SoapFault, __toString)
932
933
933
934
zend_call_function (& fci , NULL TSRMLS_CC );
934
935
935
- convert_to_string (faultcode );
936
- convert_to_string (faultstring );
937
- convert_to_string (file );
938
- convert_to_long (line );
936
+ ALLOC_ZVAL (faultcode_cp );
937
+ INIT_PZVAL_COPY (faultcode_cp , faultcode );
938
+ zval_copy_ctor (faultcode_cp );
939
+
940
+ ALLOC_ZVAL (faultstring_cp );
941
+ INIT_PZVAL_COPY (faultstring_cp , faultstring );
942
+ zval_copy_ctor (faultstring_cp );
943
+
944
+ ALLOC_ZVAL (file_cp );
945
+ INIT_PZVAL_COPY (file_cp , file );
946
+ zval_copy_ctor (file_cp );
947
+
948
+ ALLOC_ZVAL (line_cp );
949
+ INIT_PZVAL_COPY (line_cp , line );
950
+ zval_copy_ctor (line_cp );
951
+
952
+ convert_to_string (faultcode_cp );
953
+ convert_to_string (faultstring_cp );
954
+ convert_to_string (file_cp );
955
+ convert_to_long (line_cp );
939
956
convert_to_string (trace );
940
957
941
958
len = spprintf (& str , 0 , "SoapFault exception: [%s] %s in %s:%ld\nStack trace:\n%s" ,
942
- Z_STRVAL_P (faultcode ), Z_STRVAL_P (faultstring ), Z_STRVAL_P (file ), Z_LVAL_P (line ),
959
+ Z_STRVAL_P (faultcode_cp ), Z_STRVAL_P (faultstring_cp ), Z_STRVAL_P (file_cp ), Z_LVAL_P (line_cp ),
943
960
Z_STRLEN_P (trace ) ? Z_STRVAL_P (trace ) : "#0 {main}\n" );
944
961
962
+ zval_ptr_dtor (& faultcode_cp );
963
+ zval_ptr_dtor (& faultstring_cp );
964
+ zval_ptr_dtor (& file_cp );
965
+ zval_ptr_dtor (& line_cp );
945
966
zval_ptr_dtor (& trace );
946
967
947
968
RETURN_STRINGL (str , len , 0 );
0 commit comments