Possibility to turn off warnings (as they are redundant due to Exceptions being thrown) #55
Description
I'm wondering whether it would make sense to be able to turn off warnings coming from SoapClient as I would assume that most people are relying on Exceptions for error-handling?
For example, we use it like this:
<?php
try {
$client = new \Zend\Soap\Client('https://example.org/?wsdl', [
'soap_version' => SOAP_1_1,
'location' => 'https://example.org/'
]);
$client->myCommand([
'arg' => 'value'
]);
} catch (SoapFault $exception) {
// Error handling code
}
Occasionally if there's a communication error with the remote endpoint a PHP warning will be logged like this:
[Tue Jun 19 02:14:31 2018] [error] [client x.x.x.x] PHP Warning: SoapClient::__doRequest(): SSL: Connection reset by peer in /xx/vendor/zendframework/zend-soap/src/Client.php on line 1039
At the same time a SoapFaul exception is thrown which is what we use for error-handling so the warning just clogs up our error logs unnecessarily as we're already handling the situation properly.
We're using version 2.7.0 meaning this line points to https://github.com/zendframework/zend-soap/blob/release-2.7.0/src/Client.php#L1032 where SoapClient::__doRequest is called.
I notice that the PHP manual doesn't actually mention that __doRequest
can emit warnings, that might in itself be a glitch to file a bug report for regarding the ext-soap documentation?
Anyhow, even if it would be documented we would still need to silence the warnings in zend-soap if they are not wanted.
Would it make sense to switch to return @call_user_func()
or introduce a toggle that disables PHP warnings in zend-soap?
Many thanks!