Fixes #42 SoapClient->_stream_context is private in php 8#46
Fixes #42 SoapClient->_stream_context is private in php 8#46fougere2713 wants to merge 2 commits intoWsdlToPhp:developfrom
Conversation
|
Hi, thanks for the PR. |
|
Yes, that change is live on a project running php 7.4 with a generated client and custom http headers. |
|
As you mentionned |
|
The removal of AbstractSoapClientBase->setSoapClient may break stuff downstream, so a new major version makes sense. |
devloic
left a comment
There was a problem hiding this comment.
worked for me on both php7.4 and 8.2.4, macos
|
There is an issue here. If the options array passed in during construction contain a stream context, this will replace that context. |
…d not be overwritten with a new one.
|
Indeed, I just committed a fix. |
SoapClient->_stream_context is private in php8.
To work around that a stream context is systematically created during init and provided to SoapClient.
Another aproach I tried before was to get access to SoapClient->_stream_context through reflection or a closure.
That trick does not work for php internal classes, and felt a bit hacky.
I had to remove AbstractSoapClientBase->setSoapClient, since we lose access to the stream context if SoapClient is created externally.
That's a potential breaking change.