Skip to content

Fix Collection::implode with \Stringable objects - #54630

Merged
taylorotwell merged 5 commits into
laravel:11.xfrom
timkelty:bugfix/collection-implode-stringable
Feb 17, 2025
Merged

taylorotwell merged 5 commits into
laravel:11.xfrom
timkelty:bugfix/collection-implode-stringable

Conversation

@timkelty

Copy link
Copy Markdown
Contributor

Was incorrectly checking for \Illuminate\Support\Stringable.

@taylorotwell
taylorotwell merged commit 9626c3d into laravel:11.x Feb 17, 2025
@sebdesign

sebdesign commented Feb 18, 2025 •

Copy link
Copy Markdown
Contributor

@taylorotwell This PR breaks implode on eloquent collections!

The Model implements the \Stringable interface, so the condition is never truthy when the collection contains eloquent models.

E.g. calling something like $posts->implode('title', ',') no longer implodes the plucked titles from the post models.

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.

3 participants