Thanks to visit codestin.com
Credit goes to github.com

Skip to content

dump() breaks web debug toolbar #27180

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

Closed
kbond opened this issue May 7, 2018 · 3 comments
Closed

dump() breaks web debug toolbar #27180

kbond opened this issue May 7, 2018 · 3 comments

Comments

@kbond
Copy link
Member

kbond commented May 7, 2018

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 4.1

When calling dump('foo') in my code, the web debug toolbar doesn't load and I get this error in my console:

Uncaught ReferenceError: Sfdump is not defined
    at eval (eval at load.maxTries ((index):1), <anonymous>:1:9)
    at load.maxTries ((index):23)
    at (index):23
    at XMLHttpRequest.xhr.onreadystatechange ((index):23)
@ogizanagi ogizanagi added this to the 4.1 milestone May 7, 2018
@ogizanagi
Copy link
Contributor

ogizanagi commented May 7, 2018

A quick git bisect indicates that it seems to happen since e4e591b

@kbond
Copy link
Member Author

kbond commented May 7, 2018

Thanks @ogizanagi, I hadn't had a change to dig in yet.

@ogizanagi
Copy link
Contributor

Here is a fix: #27189

fabpot added a commit that referenced this issue May 9, 2018
This PR was merged into the 4.1 branch.

Discussion
----------

[Profiler] Fix dump makes toolbar disappear

| Q             | A
| ------------- | ---
| Branch?       | 4.1 <!-- see below -->
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #27180   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | N/A

Don't know if there is a better solution than executing eval on the global scope.

For ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval
> If you use the eval function indirectly, by invoking it via a reference other than eval, as of ECMAScript 5 it works in the global scope rather than the local scope. This means, for instance, that function declarations create global functions, and that the code being evaluated doesn't have access to local variables within the scope where it's being called.

Commits
-------

0cd51ae [Profiler] Fix dump makes toolbar disappear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants