Closed vroomfondle closed 10 months ago
Greetings, thank you for catching it and providing the elegant solution! :)
In terms of:
I'm happy to add a test somewhere if someone can give me a pointer to the relevant test case.
ListItemTest.php
fits for the new test to be introduced and this example demonstrates the use cases for that method
I can't execute the tests locally due to a lack of credentials (and we don't have a suitable sharepoint instance for me to run them against), but I've added a test anyway - hopefully it's good enough.
We use this library to retrieve Sharepoint lists and came across a crash when using the
getAll()
method ofClientObjectCollection
.Symptoms
When using
foreach
on aListItemCollection
, the following error occurs:Cause
I believe this is because we're using a
foreach
which is causinggetIterator
to be called and that is trying to retrieve the next set of items before it checks whether there are any more items to retrieve.Fix
Simple - I just moved the line which retrieves the items inside the conditional which checks whether items are expected to exist.
Tests
I'm happy to add a test somewhere if someone can give me a pointer to the relevant test case.