Bug #79536 [NEW]: zend_clear_exception can not call exception destructor

From: Date: Wed, 29 Apr 2020 10:55:20 +0000
Subject: Bug #79536 [NEW]: zend_clear_exception can not call exception destructor
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226819@lists.php.net to get a copy of this message
From: laruence Operating system: PHP version: 7.3.17 Package: Scripting Engine problem Bug Type: Bug Bug description:zend_clear_exception can not call exception destructor Description: ------------ zend_clear_exception: OBJ_RELEASE(EG(exception)); if the exception is refcount 1, and has __destruct, the destructor can not be called because EG(exception) is set. Test script: --------------- it could be seen by soap. <?php $GLOBALS['HTTP_RAW_POST_DATA']=" <env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:ns1=\"http://schemas.nothing.com\" > <env:Body> <ns1:dotest2> <dotest2 xsi:type=\"xsd:string\">???</dotest2> </ns1:dotest2> </env:Body> <env:Header/> </env:Envelope>"; class myFault extends SoapFault { public function __destruct() { } } function book_to_xml($book) { throw new myFault("Server", "Conversion Fault"); } class test{ function dotest2($str){ $book = new book; $book->a = "foo"; $book->b = "bar"; return $book; } } class book{ public $a="a"; public $b="c"; } $options=Array( 'actor' =>'http://schemas.nothing.com', 'typemap' => array(array("type_ns" => "http://schemas.nothing.com", "type_name" => "book", "to_xml" => "book_to_xml")) ); $server = new SoapServer(__DIR__."/classmap.wsdl",$options); $server->setClass("test"); $server->handle($HTTP_RAW_POST_DATA); echo "ok\n"; Expected result: ---------------- <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Conversion Fault</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope> ok Actual result: -------------- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Attempt to destruct pending exception</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope> -- Edit bug report at https://bugs.php.net/bug.php?id=79536&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79536&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79536&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79536&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79536&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79536&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79536&r=support Expected behavior: https://bugs.php.net/fix.php?id=79536&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79536&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79536&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79536&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79536&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79536&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79536&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79536&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79536&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79536&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79536&r=mysqlcfg

« previous php.bugs (#226819) next »