@@ -1367,6 +1367,14 @@ static void _soap_server_exception(soapServicePtr service, sdlFunctionPtr functi
13671367}
13681368/* }}} */
13691369
1370+ static void soap_free_server_object (soapServicePtr service , zval * soap_object )
1371+ {
1372+ if (service -> type == SOAP_CLASS && soap_object && service -> soap_class .persistence != SOAP_PERSISTENCE_SESSION ) {
1373+ zval_ptr_dtor (soap_object );
1374+ ZVAL_UNDEF (soap_object );
1375+ }
1376+ }
1377+
13701378/* {{{ Handles a SOAP request */
13711379PHP_METHOD (SoapServer , handle )
13721380{
@@ -1656,20 +1664,12 @@ PHP_METHOD(SoapServer, handle)
16561664 instanceof_function (Z_OBJCE (h -> retval ), soap_fault_class_entry )) {
16571665 php_output_discard ();
16581666 soap_server_fault_ex (function , & h -> retval , h );
1659- if (service -> type == SOAP_CLASS && soap_obj ) {
1660- if (service -> soap_class .persistence != SOAP_PERSISTENCE_SESSION ) {
1661- zval_ptr_dtor (soap_obj );
1662- }
1663- }
1667+ soap_free_server_object (service , soap_obj );
16641668 goto fail ;
16651669 } else if (EG (exception )) {
16661670 php_output_discard ();
16671671 _soap_server_exception (service , function , ZEND_THIS );
1668- if (service -> type == SOAP_CLASS && soap_obj ) {
1669- if (service -> soap_class .persistence != SOAP_PERSISTENCE_SESSION ) {
1670- zval_ptr_dtor (soap_obj );
1671- }
1672- }
1672+ soap_free_server_object (service , soap_obj );
16731673 goto fail ;
16741674 }
16751675 } else if (h -> mustUnderstand ) {
@@ -1682,12 +1682,7 @@ PHP_METHOD(SoapServer, handle)
16821682 ((service -> type == SOAP_CLASS || service -> type == SOAP_OBJECT ) &&
16831683 zend_hash_str_exists (function_table , ZEND_CALL_FUNC_NAME , sizeof (ZEND_CALL_FUNC_NAME )- 1 ))) {
16841684 call_status = call_user_function (NULL , soap_obj , & function_name , & retval , num_params , params );
1685- if (service -> type == SOAP_CLASS ) {
1686- if (service -> soap_class .persistence != SOAP_PERSISTENCE_SESSION ) {
1687- zval_ptr_dtor (soap_obj );
1688- soap_obj = NULL ;
1689- }
1690- }
1685+ soap_free_server_object (service , soap_obj );
16911686 } else {
16921687 php_error (E_ERROR , "Function '%s' doesn't exist" , Z_STRVAL (function_name ));
16931688 }
@@ -1696,11 +1691,7 @@ PHP_METHOD(SoapServer, handle)
16961691 if (!zend_is_unwind_exit (EG (exception ))) {
16971692 php_output_discard ();
16981693 _soap_server_exception (service , function , ZEND_THIS );
1699- if (service -> type == SOAP_CLASS ) {
1700- if (soap_obj && service -> soap_class .persistence != SOAP_PERSISTENCE_SESSION ) {
1701- zval_ptr_dtor (soap_obj );
1702- }
1703- }
1694+ soap_free_server_object (service , soap_obj );
17041695 }
17051696 goto fail ;
17061697 }
@@ -1736,11 +1727,7 @@ PHP_METHOD(SoapServer, handle)
17361727 if (EG (exception )) {
17371728 php_output_discard ();
17381729 _soap_server_exception (service , function , ZEND_THIS );
1739- if (service -> type == SOAP_CLASS ) {
1740- if (soap_obj && service -> soap_class .persistence != SOAP_PERSISTENCE_SESSION ) {
1741- zval_ptr_dtor (soap_obj );
1742- }
1743- }
1730+ soap_free_server_object (service , soap_obj );
17441731 goto fail ;
17451732 }
17461733
0 commit comments