Skip to content

[MorphTo] Preserve string "0" keys when gathering eager load IDs#58669

Draft
Tresor-Kasenda wants to merge 1 commit intolaravel:12.xfrom
Tresor-Kasenda:feature/morphto-string-zero-key-fix
Draft

[MorphTo] Preserve string "0" keys when gathering eager load IDs#58669
Tresor-Kasenda wants to merge 1 commit intolaravel:12.xfrom
Tresor-Kasenda:feature/morphto-string-zero-key-fix

Conversation

@Tresor-Kasenda
Copy link
Contributor

MorphTo::gatherKeysByType() used array_filter() without a callback, which removed falsey values including the valid string key "0" for string key types.

This patch keeps "0" and only filters out empty-string keys, then adds a regression test to cover this behavior.

`MorphTo::gatherKeysByType()` used `array_filter()` without a callback,
which removed falsey values including the valid string key "0" for string
key types.

This patch keeps "0" and only filters out empty-string keys, then adds a
regression test to cover this behavior.
@taylorotwell
Copy link
Member

Tests failing.

@taylorotwell taylorotwell marked this pull request as draft February 7, 2026 17:14
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

Comments