WsdlToPhp / PackageBase

Contains base classes from which the generated classes from PackageGenerator inherit
MIT License
24 stars 26 forks source link

setHttpHeaders tries to access SoapClient::$_stream_context property which is private #42

Open gigerIT opened 2 years ago

gigerIT commented 2 years ago

Hello Everyone

i just came across an error when trying to set custom http headers. $get->setHttpHeader("x-api-key", "123456");

Which throws an error: Cannot access private property SoapClient::$_stream_context

Caused by the line 343 in AbstractSoapClientBase: $state = ($this->getSoapClient()->_stream_context = stream_context_create($options)) ? true : false;

I'm using PHP 8.1

mikaelcom commented 2 years ago

It's caused by PHP > 8.0. I did not take time to handle this yet. Until PHP <= 8.0, the _stream_context was accessible and allowed to set the stream context used by the SoapClient when sending the request.

If you have any clue or idea to handle this, feel free to share your thoughts.