ID: 36388 User updated by: david at jool dot nl -Summary: PHP crash when throwing exception and session persistence Reported By: david at jool dot nl Status: Assigned Bug Type: SOAP related Operating System: winxp PHP Version: 5CVS-2006-02-14 (snap) Assigned To: dmitry New Comment:
Possible patch --- F:\dev\php 5.1.2\php-src\ext\soap\soap.c Sun Jan 01 13:50:14 2006 +++ f:\dev\php-modified\ext\soap\soap.c Wed Mar 01 15:04:19 2006 @@ -1712,7 +1712,7 @@ instanceof_function(Z_OBJCE_P(EG(exception)), soap_fault_class_entry TSRMLS_CC)) { soap_server_fault_ex(function, EG(exception), NULL TSRMLS_CC); } else { - if (soap_obj) {zval_ptr_dtor(&soap_obj);} + if (soap_obj && service->soap_class.persistance != SOAP_PERSISTENCE_SESSION) {zval_ptr_dtor(&soap_obj);} php_end_ob_buffer(0, 0 TSRMLS_CC); goto fail; } Previous Comments: ------------------------------------------------------------------------ [2006-02-14 11:15:27] david at jool dot nl Description: ------------ When using the soap extension to expose a certain class and setting the persistence to SOAP_PERSISTENCE_SESSION, PHP crashes when I throw an Exception. Reproduce code: --------------- <?php class test1 { function soapFunction($param) { throw new Exception("something went wrong"); return "blaat aap: ". $param; } } if($_GET["type"]=="server") { $server = new SOAPServer(null, array("uri"=> "http://some.example.uri/")); $server->setClass("test1"); $server->setPersistence(SOAP_PERSISTENCE_SESSION); $server->handle(); } else { //client $client = new SOAPClient(null, array('location' => 'http://'.$_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"].'?type=server', 'uri'=> 'http://some.example.uri/')); $res = $client->__call("soapFunction", array("hey!")); var_dump($res); } ?> Expected result: ---------------- Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML document in f:\myweb\contentarea\tests\bug_exception.php:15 Stack trace: #0 f:\myweb\contentarea\tests\bug_exception.php(15): SoapClient->__call('soapFunction', Array) #1 {main} thrown in f:\myweb\contentarea\tests\bug_exception.php on line 15 Actual result: -------------- PHP / Apache crash ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36388&edit=1