Skip to content

[13.x] Fix iterable support in Arr::last()#60881

Merged
taylorotwell merged 1 commit into
laravel:13.xfrom
Amirhf1:fix/arr-last-iterables
Jul 24, 2026
Merged

[13.x] Fix iterable support in Arr::last()#60881
taylorotwell merged 1 commit into
laravel:13.xfrom
Amirhf1:fix/arr-last-iterables

Conversation

@Amirhf1

@Amirhf1 Amirhf1 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Arr::last() documents support for iterable values, but currently passes its input directly to array-only functions such as array_last() and array_reverse().

Passing an ArrayIterator, generator, or another non-array iterable therefore results in a TypeError.
This change normalizes the input through Arr::from() before applying the existing logic.

@taylorotwell
taylorotwell merged commit ae66e4c into laravel:13.x Jul 24, 2026
23 of 55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants