-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[BUG][Profiler][Timeline] JS error with custom events/sections #30745
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
Found another bug in Randomly, my page had I'm not sure how to fix this. I would probably get rid of those sprintf calls, but that would mean assuming that I really get floats/integers. If something else gets there it may fail. Another solution may be to just move that code to the Collector, handle it properly in PHP (will all the needed casts) and then dump it in Twig with Please advise. Thanks ! |
Picking this up at EUFOSSA. Status: reviewed |
I fixed the first issue in #30973 The second issue just sounds like GIGO to me - you're "corrupting" the data to something it shouldn't ever contain. Not something I really think we can make the profiler resistant to. |
@curry684 thank you very much for your fix :) Thanks again ! |
…atch categories (curry684) This PR was squashed before being merged into the 4.3-dev branch (closes #30973). Discussion ---------- [WebProfiler] Fix Javascript error when using custom stopwatch categories Fixes #30745 | Q | A | ------------- | --- | Branch? | master | 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 | Tests pass? | yes | Fixed tickets | #30745 | License | MIT Made the getter do lazy creation so it can dynamically adapt to whatever it's given. Commits ------- e991472 [WebProfiler] Fix Javascript error when using custom stopwatch categories
Symfony version(s) affected: 4.3-DEV
Description
Looks like #30450 broke the Timeline panel in profiler with sections other than standard symfony ones. I have a custom caching bundle that uses the Stopwatch to measure (and also display in profiler) cache call duration. When the Timeline page loads, it throws JS error because the category
ovrflo_cache
does not exist (as it is not one of the hardcoded ones).How to reproduce
This controller will reproduce the problem:
Click on the debug toolbar, go to Timeline, open Dev Tools and you'll see the error.
Possible Solution
I fiddled with the JS in
@WebProfiler/Collector/time.js
and I got it to work. I am ready to submit a PR with my code, but I'm not proud of it. I'm a bit rusty with JS/ES6. If you want me to submit a PR with my fix, let me know. If someone else wants to take a stab at it, the issues I found are with 2 callsLegend.add
cannot find the category inthis.categories
Legend.getClassname
cannot find the category inthis.classnames
My fix detects those undefined values and adds the category in both places with default values.
Edit: I just pushed my fix if anyone wants to take a look at it: ovrflo@17be20a
This probably affects any third party bundle that uses the Stopwatch. We should fix this ASAP.
The text was updated successfully, but these errors were encountered: