spatie / period

Complex period comparisons
https://spatie.be/open-source
MIT License
1.65k stars 73 forks source link

Reindex collection array after filtering values #87

Closed endelwar closed 3 years ago

endelwar commented 3 years ago

IterableImplementation relies on a zero-indexed offset; when filtering a collection $collection->periods array isn't reindexed, causing collection iteration to stop at the first hole in the index. Applying array_values to array_filter results fixes the bug. array_values performs better than splat-packing.

freekmurze commented 3 years ago

Thanks!

endelwar commented 3 years ago

Glad to help!