Laravel/PHP dd() displays non-structured arrays in Chrome developer tools
Asked Answered
E

2

8

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).

enter image description here

before it was something like this (at least it seems to me that it was like this): enter image description here

Do I have 'false memories'?

OR, if dd() really outputted structured arrays in devtools, how do I bring it back?

Electromyography answered 21/9, 2017 at 10:42 Comment(5)
The response tab should do a better jobCholeric
just install json view plugin.Rattoon
Sounds like a bug. See if it's fixed in Chrome Canary, otherwise look for existing reports on crbug.com or submit a new one if you can provide an easily reproducible test URL.Erlina
response tab: joxi.ru/nAyzY10IYB58XrElectromyography
You do not have 'false memories' :) I use this all the time. I hope this get fixed really soon...Alsatia
E
0

I've posted the same question in official chrome bugs forum https://bugs.chromium.org/p/chromium/issues/detail?id=767386#c5 they said that it'd be corrected in Chrome 62 released on 17-OCT-2017, which is... TODAY:)

Electromyography answered 17/10, 2017 at 8:35 Comment(0)
S
0

I'm using Chrome Version 63.0.3239.132 (Official Build) (64-bit) and still have the issue.

Workaround until the bug is fixed.

http_response_code(500);
dd('foo');

Turn it into a helper function ddd

1) Create a file called helpers.php in app/Http

2) Past the following in:

<?php 

function ddd(...$args){
    http_response_code(500);
    call_user_func_array('dd', $args);
}

3) In composer.json, in the autoload section, add "files": ["app/Http/helpers.php"]

4) Run composer dump-autoload command in terminal

Seigneur answered 29/1, 2018 at 1:41 Comment(1)
For me it´s the same resultInterlock

© 2022 - 2024 — McMap. All rights reserved.