Fix SOAP stdClass conversion for array|string union types#287
Fix SOAP stdClass conversion for array|string union types#287kambereBr wants to merge 3 commits intoGarethp:masterfrom
Conversation
|
Hi @Garethp Whenever you have a moment, could you please take a look at this PR? Thank you! |
|
Would you mind adding a test so that I can see what's actually causing the error? |
Yes, sure. I'm adding the test now. |
4dcae79 to
7794e3e
Compare
@Garethp I've just added a test to cover this. Thanks! |
|
I'll take a look at this later, thanks! If it's not too much trouble, and if you have access to an Exchange account, would you be able to make that a test that actually contacts Exchange and records the response, rather than trying to construct a similar shape as you'd expect from the response? I'm not 100% sure I'll end up doing this, but one of the features I wouldn't mind attempting before I publish a That said, if you don't have access to Exchange, no worries and I'll still pick this up and get this merged in you. |
Sounds good! I have access to an Exchange account, so I'll record real SOAP responses and add recording tests that actually contact Exchange. I'm switching this PR to draft while I work on the recordings. I'll request another review once it's complete. Thank you! |
|
FYI, we are getting the same error:
When calling: |
…union type in CalendarItem
e2af68b to
6c56def
Compare
|
@kambereBr I've checked our logs further and found a similar problems: Maybe it helps. |
Hello @gazben Thanks for reporting this, it really helped to add a proper integration test. I had some trouble reproducing the original issue since the emails in the shared Exchange test account had been cleared, so I lacked the right data to trigger the error. Your example made it much easier to reproduce the issue. |
|
Hi @Garethp This PR is ready for another review. Thanks! |
This PR fixes SOAP stdClass conversion when properties expect union types like
array|stringError message 1:
Fatal error: Uncaught SoapFault exception: [Client] During class fetch: Uncaught TypeError: garethp\ews\API\Type\ContactType::setEmailAddresses(): Argument #1 ($value) must be of type array|string, stdClass given, called in cypht/vendor/garethp/php-ews/src/API/MagicMethodsTrait.php on line 23 and defined in cypht/vendor/garethp/php-ews/src/API/Type/ContactType.php:206Error message 2:
garethp\ews\API\Type\ItemType::setCategories(): Argument #1 ($value) must be of type array|string, stdClass given, called in /var/www/html/vendor/garethp/php-ews/src/API/MagicMethodsTrait.php on line 23