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

dd() output colors not overridden by Laravel #24913

Closed
bcorcoran opened this issue Jul 20, 2018 · 8 comments
Closed

dd() output colors not overridden by Laravel #24913

bcorcoran opened this issue Jul 20, 2018 · 8 comments

Comments

@bcorcoran
Copy link

bcorcoran commented Jul 20, 2018

  • Laravel Version: 5.6.28
  • PHP Version: 7.2.6
  • Database Driver & Version: n/a

Description:

Calling dd() no longer overrides the (hard/uncomfortable to read, in my opinion) default styles of Symfony\Component\VarDumper\Dumper\HtmlDumper

The Illuminate\Support\Debug\HtmlDumper class is still there, but it appears to not be having any effect on the dd() output.

Steps To Reproduce:

  1. Install fresh copy of laravel with laravel new <appname>
  2. dd() some data
  3. See black/green/orange dump output
@devcircus
Copy link
Contributor

devcircus commented Jul 20, 2018

Maybe because Symfony added a "dd" helper that is taking precedence.
To test, you can go inside the dd function in Illuminate\Support\helpers.php and try to dump something else. The method doesn't even get called.

See: this pull request on symfony's repo for details.

@themsaid @taylorotwell

@GabrielaSaldana
Copy link

Probably dd is defaulting in some kind of config file for dumping text, as devcircus said try to search inside the dd function.

@istratos
Copy link

istratos commented Aug 1, 2018

I can confirm the issue comes from Symfony adding a dd() helper, since it's now registered, Laravel can't register its own. dd() now calls Symfony's, not Laravel's thus printing it with Symfony's default (and ugly) stylings.

Perhaps we can keep using Symfony's dd() since it essentially does the same, but somehow keep Laravel's styles. It's super painful to watch the current styling.

@tillkruss
Copy link
Contributor

Any PRs would be greatly appreciated.

@bcorcoran
Copy link
Author

I'm struggling to find a way within the current implementation (in laravel) to even extend the symfony VarDumper. Maybe it's obvious; perhaps I've not had enough coffee today.

You can remove the `use Illuminate\Support\Debug\Dumper;' statements everywhere, and the symfony dumper still works, so... where/when is it being implemented? I've never really done any edits on the framework so I'm kind of lost right now.

@devcircus
Copy link
Contributor

The Laravel dd() is completely useless at this point. The Symfony version will always be called. Actually the Laravel function is now, not even defined:

// Illuminate\Support\helpers.php
if (! function_exists('dd')) {}

Of couse, you have to check for the existence first, or a fatal error will occur. So the only thing left for Laravel to do is remove the global dd() helper.

The Symfony version is declared here Symfony/Component/VarDumper/Resources/functions. "symfony/var-dumper": "~4.0" is required in Laravel's composer.json.

@bcorcoran
Copy link
Author

Right, I think that is understood at this point. It would still be nice to extend the existing symfony class in such a way that it overrode the $styles var set in Symfony\Component\VarDumper\Dumper\HtmlDumper.

@tillkruss
Copy link
Contributor

Looks like this is a won't fix: #25086

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

No branches or pull requests

5 participants