-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[profiler] Fix conditional expression to provide a default value #16653
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
Conversation
From the cookbook: <cite>{# the 'link' value set to 'false' means that this panel doesn't show a section in the web profiler (default is 'true'). #}</cite> Simple conditional expression is not enough to provide a default value for the link parameter ```twig {% if link %} ```
Shouldn't we rather ensure that the |
Not necessarily. In principle, data profiles include a larger area, so view of the details is the expected function. Otherwise documentation differs from implementation. |
ping @javiereguiluz |
given that this template is meant to be included by collector templates from any bundle, we cannot ensure it is always defined (except by putting a |
@xabbuh I think @krzysiekpiasecki is right because according to the documentation:
My only comment for @krzysiekpiasecki is this one: do you think we could replace |
Yes, you could. |
@krzysiekpiasecki if you have some more time for this, please change the condition so we can merge this. Thanks a lot! |
Closing this one, I'm going to create a new PR on 2.3 with @javiereguiluz suggestion. |
This PR was merged into the 2.3 branch. Discussion ---------- fixed undefined variable | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #16653 | License | MIT | Doc PR | n/a Commits ------- 4b21351 fixed undefined variable
…moving inadvertently added links (craue) This PR was merged into the 2.3 branch. Discussion ---------- [2.3][WebProfilerBundle] fix debug toolbar rendering by removing inadvertently added links | Q | A | ------------- | --- | Branch | 2.3+ | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | The debug toolbar was broken by #17527... **before**  **and after**  **explanation** If `false` is explicitly passed for `link` then `link | default(true)` would evaluate to `true`, which is not what we want. The correct expression `link is not defined or link` was suggested originally in #16653. Commits ------- a0ddfc4 fix debug toolbar rendering by removing inadvertently added links
Fix conditional expression to provide a default value and prevent from the exception
From the cookbook:
{# the 'link' value set to 'false' means that this panel doesn't show a section in the web profiler (default is 'true'). #}
Simple conditional expression is not enough to provide a default value for the link parameter if is missed.
Custom collector
WebProfiler/Profiler/toolbar_item.html.twig