-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
The function dd() is not working in laravel #39394
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
Comments
Can you create a small example application that allows to reproduce your issue? |
@buffary we need to understand what happens technically first, before we can answer the why. So any insights what's causing length=9 but We need to isolate the problem. Maybe it can be reproduced as simple as A piece of code reproducing the output from the screenshot above allows others to gain such insights as well. |
P.S. |
All right, please help a Laravel noob like me to reproduce the problem: Please create a small application that I can run to reproduce the problem. Share that application as a GitHub repo and link it in this thread. Thanks! |
Hello, Here is an empty app with the bug. On the home page at the top there is a dump() of an array, everything works. Then next to the Laravel logo I put a horrible button "Axios Request" For info dump() and dd() behave the same way. The code for these two debugs can be found in HomeController.php. I hope I was chaired enough this time ... Thank you. |
Changes made in this commit changed the behaviour in 5.2.0: This "improve" of the "rendering" messed up response inspectors. |
Thanks for the details, the related PR is #35959. |
Hi @derrabus I tracked down the changed behavior to this commit: symfony/var-dumper@4b5ca00 Reverting it brings the old behavior back. Note it only happens when previewing the results of calling It doesn't need to be an AJAX call, you can preview a regular page, in the regular browser nested properties will be interactive/collapsible, while if previewing the HTML document on the developer tools' network tab it won't be interactive/expandable. Previous behavior before the commit above was to have all properties expanded when previewing on the network tab. To reproduce it you don't need to use Laravel. You can reproduce this with the following steps: mkdir test
cd test
composer init
composer require symfony/var-dumper
echo "<?php require __DIR__ . '/vendor/autoload.php'; dd(['foo' => [1,2,3]]);" > index.php
php -S localhost:8000
My guess is that the commit above changed the output from expanded by default to collapsed by default. And as the network tab's preview pane doesn't run JavaScript the results cannot be expanded. Users might be relying on the results to be expanded to debug AJAX calls. Hope this helps. |
Hi @nicolas-grekas and @bpuig I was typing my response before seeing yours. Unfortunately I am not familiar with symfony's codebase/code-style to send a PR. Hope it can help debugging it. |
The codebase here is very simple here: a single file is used to generate all the HTML & JavaScript. |
@rodrigopedra Indeed I had not thought of looking at the network tab in a page debug without AJAX call (since it is displayed directly on the web page) |
Please give #39525 a try and confirm it fixes the issue if you can. |
Hi @nicolas-grekas I tried #39525 and it is working as expected regarding the network tab. I guess, as the JavaScript code is the first thing rendered, it will also prevent any flickering reported by issue #35800. Thanks! |
Hello, @nicolas-grekas #39525 works for me ! Thanks ! |
… (nicolas-grekas) This PR was merged into the 5.2 branch. Discussion ---------- [VarDumper] dont hide any nodes until JS is proven to work | Q | A | ------------- | --- | Branch? | 5.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #39394 | License | MIT | Doc PR | - Replaces #39523 Commits ------- 42ad1ec [VarDumper] dont hide any nodes until JS is proven to work
Symfony version(s) affected: symfony/var-dumper:5.2
PHP version:8.0
Laravel version:8.17.2
Description
When I print the collection use the dd function, I cannot see the nested content inside the collection,like the following,
Illuminate\Database\Eloquent\Collection {#992 #items: array:9 [] }
i cant see any items,the previous version can be expanded to view specific items
The text was updated successfully, but these errors were encountered: