You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.
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?
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.
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!
The text was updated successfully, but these errors were encountered:
Silencing is not an option: explicit suppression with an error handler that is restored immediately after the call is a better solution, but the error handler must only take warnings and convert them to exceptions
Well, in this particular case as I stated a SoapFault Exception is already being thrown as that's what I successfully use for my error handling. That's why the warning is meaningless to me, hence my suggestion that simply silencing might be an alternative.
Maybe something like this would do the trick?
// Catch warnings (to prevent them from being logged)
set_error_handler(function ($errno, $errstr) {
// Intentional no-op
}, E_WARNING);
$response = call_user_func(
[$client, 'SoapClient::__doRequest'],
$request,
$location,
$action,
$version,
$oneWay
);
// Restore previous error handler again
restore_error_handler();
return $response;
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:
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!
The text was updated successfully, but these errors were encountered: