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.5] Make Collection::dd() & Collection::dump() show the same result #22036

Merged
merged 1 commit into from
Nov 10, 2017

Conversation

antonioribeiro
Copy link
Contributor

If you do

collect([1, 3])->dump(5);

echo "------------------------------------------\n";

collect([1, 3])->dd(5);

You'll see dd() and dump() shows a completely different result:

5
Illuminate\Support\Collection {#783
  #items: array:2 [
    0 => 1
    1 => 3
  ]
}
------------------------------------------
array:2 [
  0 => 1
  1 => 3
]

This PR fix this so they both behave the same way:

5
Illuminate\Support\Collection {#783
  #items: array:2 [
    0 => 1
    1 => 3
  ]
}
------------------------------------------
5
Illuminate\Support\Collection {#783
  #items: array:2 [
    0 => 1
    1 => 3
  ]
}

@GrahamCampbell GrahamCampbell changed the title Make Collection::dd() & Collection::dump() show the same result [5.5] Make Collection::dd() & Collection::dump() show the same result Nov 9, 2017
@GrahamCampbell
Copy link
Member

GrahamCampbell commented Nov 9, 2017

This is possibly a breaking change? Maybe best to target 5.6?

@antonioribeiro
Copy link
Contributor Author

dd() is the last frontier, since there's nothing after it, it cannot break our apps...

@laurencei
Copy link
Contributor

laurencei commented Nov 10, 2017

I think it's a great PR.

Technically @GrahamCampbell could be correct though.

If someone was running an API and returning the output of a HTTP call via dd($var) - this would change the output of the API result?

I know no one should be doing that - but I've seen this type of silly stuff in people's questions/answers on StackoverFlow, reddit etc - so it is occurring out there.

The question is, because they are not using it in the intended manner, do we hold off on the PR because of people doing it the "wrong" way... I dont mind either way - just putting it out there.

@taylorotwell taylorotwell merged commit 26f1679 into laravel:5.5 Nov 10, 2017
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.

4 participants