Bug #73747 [NEW]: SoapClient::__getLastResponse() is empty if SoapFault raised

From: Date: Thu, 15 Dec 2016 09:43:13 +0000
Subject: Bug #73747 [NEW]: SoapClient::__getLastResponse() is empty if SoapFault raised
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206028@lists.php.net to get a copy of this message
From: richardh at channelgrabber dot com Operating system: Ubuntu 14.04.1 LTS PHP version: 7.1.0 Package: SOAP related Bug Type: Bug Bug description:SoapClient::__getLastResponse() is empty if SoapFault raised Description: ------------ If you configure a SoapClient with both exceptions and trace set to TRUE, and the server errors with a SoapFault, the client throws a php SoapFault exception. In php 5.6, if the SoapFault was caught, you could ask the SoapClient for the request SoapClient::__getLastRequest() and response SoapClient::__getLastResponse() to investigate the issue. However with php 7.1, and 7.0 it seems, both methods return an empty string if a SoapFault was thrown. Expected behaviour is the return of the failed request and response so you can investigate the issue. We have been able to reproduce the issues by testing against a mock server created with SoapUI (https://www.soapui.org/downloads/soapui.html) against a simple example wsdl (https://www.tutorialspoint.com/wsdl/wsdl_example.htm), by setting the response to always be a SoapFault. Test script: --------------- <?php $soapClient = new SoapClient( './HelloService.wsdl', [ 'location' => 'http://127.0.0.1:8080', 'trace' => true, 'exceptions' => true ] ); try { $soapClient->sayHello('Php'); } catch (SoapFault $exception) { echo 'Request: ' . trim($soapClient->__getLastRequest()) . PHP_EOL; echo PHP_EOL; echo 'Response: ' . trim($soapClient->__getLastResponse()) . PHP_EOL; } Expected result: ---------------- Request: <XML REQUEST> Response: <XML RESPONSE> Actual result: -------------- Request: Response: -- Edit bug report at https://bugs.php.net/bug.php?id=73747&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73747&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73747&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73747&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73747&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73747&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73747&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73747&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73747&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73747&r=support Expected behavior: https://bugs.php.net/fix.php?id=73747&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73747&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73747&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73747&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73747&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73747&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73747&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73747&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73747&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73747&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73747&r=mysqlcfg

« previous php.bugs (#206028) next »