msgraph-sdk-php icon indicating copy to clipboard operation
msgraph-sdk-php copied to clipboard

Wrong type returned when property is null

Open risototh opened this issue 4 years ago • 0 comments

I executed a request to obtain list of calendar Events, and when I call $event->getRecurrence() on Event, that does not have any recurrences, the call will return PatternedRecurrence object with empty _propDict (or better to say, it's not pointing to empty array, but to null), so the subsequent call $event->getRecurrence()->getPattern() will fail in the getPattern() method on array_key_exists() expects parameter 2 to be array, null given in /sites/freedom3/lib/vendor-composer/microsoft/microsoft-graph/src/Model/PatternedRecurrence.php on line 35.

This is because the getRecurrence() method returns null only in case, that the recurrence key is missing, not in case, that the recurrence points to null.

risototh avatar Sep 20 '21 13:09 risototh