@@ -983,6 +983,11 @@ PHP_METHOD(SoapServer, __construct)
983983			}
984984		}
985985
986+ 		if  ((tmp  =  zend_hash_find (ht , ZSTR_KNOWN (ZEND_STR_TRACE ))) !=  NULL  && 
987+ 		    (Z_TYPE_P (tmp ) ==  IS_TRUE  || 
988+ 		     (Z_TYPE_P (tmp ) ==  IS_LONG  &&  Z_LVAL_P (tmp ) ==  1 ))) {
989+ 			service -> trace  =  true;
990+ 		}
986991	} else  if  (!wsdl ) {
987992		php_error_docref (NULL , E_ERROR , "'uri' option is required in nonWSDL mode" );
988993	}
@@ -1644,6 +1649,12 @@ PHP_METHOD(SoapServer, handle)
16441649			sapi_add_header (cont_len , strlen (cont_len ), 1 );
16451650		}
16461651		php_write (buf , size );
1652+ 		if  (service -> trace ) {
1653+ 			if  (service -> last_response_body ) {
1654+ 				zend_string_release_ex (service -> last_response_body , false);
1655+ 			}
1656+ 			service -> last_response_body  =  zend_string_init ((const  char  * ) buf , size , false);
1657+ 		}
16471658		xmlFree (buf );
16481659	} else  {
16491660		sapi_add_header ("HTTP/1.1 202 Accepted" , sizeof ("HTTP/1.1 202 Accepted" )- 1 , 1 );
@@ -1752,6 +1763,16 @@ PHP_METHOD(SoapServer, addSoapHeader)
17521763}
17531764/* }}} */ 
17541765
1766+ PHP_METHOD (SoapServer , __getLastResponse )
1767+ {
1768+ 	soapServicePtr  service ;
1769+ 	ZEND_PARSE_PARAMETERS_NONE ();
1770+ 	FETCH_THIS_SERVICE_NO_BAILOUT (service );
1771+ 	if  (service -> last_response_body ) {
1772+ 		RETURN_STR_COPY (service -> last_response_body );
1773+ 	}
1774+ }
1775+ 
17551776static  void  soap_server_fault_ex (sdlFunctionPtr  function , zval *  fault , soapHeader  * hdr ) /* {{{ */ 
17561777{
17571778	int  soap_version ;
@@ -4533,6 +4554,9 @@ static void delete_service(soapServicePtr service) /* {{{ */
45334554		zend_hash_destroy (service -> class_map );
45344555		FREE_HASHTABLE (service -> class_map );
45354556	}
4557+ 	if  (service -> last_response_body ) {
4558+ 		zend_string_release_ex (service -> last_response_body , false);
4559+ 	}
45364560	zval_ptr_dtor (& service -> soap_object );
45374561	efree (service );
45384562}
0 commit comments