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 1 commit into from Jul 18, 2019


Copy link

commented Jul 17, 2019

#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

2 checks passed

continuous-integration/styleci/pr The analysis has passed
continuous-integration/travis-ci/pr The Travis CI build passed

@staudenmeir staudenmeir deleted the staudenmeir:collection branch Jul 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.