Framework: Laravel dd($array) displays non-structured array in Chrome developer tools

Created on 21 Sep 2017  路  10Comments  路  Source: laravel/framework

  • Laravel Version: #.#.#
  • PHP Version: 7.1.3
  • Database Driver & Version: InnoDB

Description:

I have noticed that writing in Laravel's Controller:
dd($array)
outputs an un-structured view of array in Chrome Developer Tools (chome 61.0.3163.91 64-bit, MAC OS).
1
before it was something like:
2

here is what I see in Chrome->DevTools->Network->Response:
response.txt

Steps To Reproduce:

(1) Create a controller and link it to web route.
(2) Create array ($array) inside a controller and dd($array);
(3) Load url for a route and see Chrome->DevTools->Network->Preview:

Most helpful comment

This bug is back on Chrome 72. Also for laravel 5.5. The easiets solution (for me and for now), is downgrade google-crome-stable to version 71.

You can download here: https://www.slimjet.com/chrome/google-chrome-old-version.php

All 10 comments

Its because you are getting "dd" result (var_dump() kind with types). Chrome dev tools preview only valid JSON data the way you seek.

Try

echo json_encode($array);
die();

This isn't a bug and can be closed :+1:

Hi! But I still think it's a bug. Maybe of Chrome.
Here are screenshots:
1) my code with dd
screen1

2) output in most recent version of Chrome in DevTools
screen2
3) output in previous Chrome version:
screen3

It's obviuosly the Chrome version that causes the problem.

This bug is back on Chrome 72. Also for laravel 5.5. The easiets solution (for me and for now), is downgrade google-crome-stable to version 71.

You can download here: https://www.slimjet.com/chrome/google-chrome-old-version.php

I agree with @rafwell on this one. In my case the preview pane was completely blank when moving to version 72 of google and doing a simple dd(). Going back to 71 is the only thing that worked for me.

Just for the record this is also broken on Chrome 73.

Isn't dd() a symfony helper? Maybe 5.5 still has the laravel version though.

@devcircus I believe it wasn't in 2017. This thread is a tad old.

same for me.
screen shot 2019-02-27 at 8 51 29 am

It shows blank. Nothing is showed. I have to use var_dump and die instead.

I'm locking this as I doubt anyone can contribute anything more than reporting that they also have the bug. This doesn't seems like anything we can fix ourselves.

Was this page helpful?
0 / 5 - 0 ratings