PackageBase icon indicating copy to clipboard operation
PackageBase copied to clipboard

setSoapHeader calls overwrite previously set headers

Open mlaurense opened this issue 2 years ago • 3 comments

This seems to be a PHP 8 issue. Due to the __default_headers being a private property, subsequent calls to setSoapHeader overwrite the previously set headers.

mlaurense avatar May 15 '23 12:05 mlaurense

Might be fixed by https://github.com/WsdlToPhp/PackageBase/pull/46, but tests are failling for now, I did not have the time to fix it yet

mikaelcom avatar May 22 '23 07:05 mikaelcom

I think the fix would be to change the signature of AbstractSoapClientBase->setSoapHeader to allow for an array, or add another method to setup the default headers. Currently, no matter what setSoapHeader will always override headers not set directly on the underlying SOAP client. It seems that due to all the properties goign private in PHP 8, the only way to properly do this is to manage the headers internal to the abstract class. Or, if the user wants this functionality, they could expose the __default_headers in their own __soap_client. The fix in #46 of removing ->setSoapClient isn't acceptable as we need to be able to inherit and override some of the base calls in order to implement logging and such.

awaters-pa avatar Nov 17 '23 20:11 awaters-pa

Feel free to make a PR if you're comfortable enough, we'll discuss about it then, thanks

mikaelcom avatar Nov 22 '23 12:11 mikaelcom