Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.8] Fix collections with JsonSerializable items and mixed values #29205

Merged
merged 1 commit into from
Jul 18, 2019
Merged

[5.8] Fix collections with JsonSerializable items and mixed values #29205

merged 1 commit into from
Jul 18, 2019

Conversation

staudenmeir
Copy link
Contributor

#11739 added support for collections with JsonSerializable items.

It only considered cases where jsonSerialize() returns an array, but the method can return mixed values.

If it does, you end up with an invalid collection where $items is not an array:

collect(new Carbon);

// expected
Collection { ▼
  #items: array:1 [▼
    0 => "2019-07-17T16:24:29.660974Z"
  ]
}

// actual
Collection { ▼
  #items: "2019-07-17T16:24:29.660974Z"
}

Fixes #29187.

@taylorotwell taylorotwell merged commit 7e9a7c6 into laravel:5.8 Jul 18, 2019
@staudenmeir staudenmeir deleted the collection branch July 18, 2019 14:23
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.

Problem with collections
3 participants