Skip to content

Conversation

@jessarcher
Copy link
Member

When calling the dd method on a Collection or a class using the Dumpable trait, it currently outputs a second dump containing just the 🐛 emoji.

collect(['test'])->dd();

image

now()->dd();

image

The emoji is output by symfony/var-dumper when no arguments are passed to the dd function.

We see it with Collections and Dumpable classes because our dd methods call their own dump method, followed by an empty dd call.

A side effect is that the response will return a 200 instead of the usual 500 that the dd function returns when there is no previous output, because the first dump prevents dd from setting headers.

This PR addresses this by making the dd methods just call the dd function directly. The only downside I can see is if someone has customized their dump method, the dd method will no longer use it.

An alternative would be to continue calling the dump method, followed by an exit call. However, dd has some additional logic to set headers which we might want to reimplement.

@jessarcher jessarcher changed the title [11.x] Prevent bug (🐛) emoji on dumpable dd [11.x] Prevent bug (🐛) emoji on Collection/Dumpable dd method Jul 22, 2024
@jessarcher jessarcher changed the title [11.x] Prevent bug (🐛) emoji on Collection/Dumpable dd method [11.x] Prevent bug (🐛) emoji on Collection/Dumpable dd method Jul 22, 2024
@taylorotwell taylorotwell merged commit 4fcf4a6 into 11.x Jul 23, 2024
@taylorotwell taylorotwell deleted the prevent-bug-emoji-on-dd branch July 23, 2024 14:08
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