Does PHP 8.1 break the functionality of the inner class SoapClient?
P粉615886660
P粉615886660 2023-12-12 22:52:40
0
1
429

While making a library that uses PHP's SoapClient and is compatible with PHP 8.1, I ran into this problem:

All properties of SoapClient are now private when they were previously public. So things like getting the last soap fault ($soapClient->__soap_fault) are no longer possible. But if something goes wrong, most methods of SoapClient will return null, and the only way to know what the problem is is to get the __soap_fault that is no longer accessible.

How should I use method __doRequest when I don't have access to SoapClient properties?

P粉615886660
P粉615886660

reply all(1)
P粉969666670

Looking at the old SoapClient documentation, it seems that accessing properties directly is always an error - for php7.2 e.g. depending on the backhaul machine, __soap_fault is not documented at all (see https:// /web.archive.org/web/20171211100753/http://us3.php.net/manual/en/class.soapclient. php)

The document description is as follows:

I would say, make sure you enable exceptions (by passing $options['exceptions'] => true to the SoapClient constructor) and handle these exceptions in a try/catch Correspondingly. If this doesn't help, a new question with the specific error that wasn't handled correctly might be more helpful.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!