Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
krzysiekpiasecki wants to merge1 commit intosymfony:2.8fromkrzysiekpiasecki:patch-1
Closed

[profiler] Fix conditional expression to provide a default value#16653

krzysiekpiasecki wants to merge1 commit intosymfony:2.8fromkrzysiekpiasecki:patch-1

Conversation

@krzysiekpiasecki
Copy link
Contributor

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.

 {%iflink %}

Custom collector

{{include('@WebProfiler/Profiler/toolbar_item.html.twig') }}

WebProfiler/Profiler/toolbar_item.html.twig

 {%iflink %}

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 %}```
@krzysiekpiaseckikrzysiekpiasecki changed the titleFix conditional expression to provide a default value[profiler] Fix conditional expression to provide a default valueNov 24, 2015
@xabbuh
Copy link
Member

Shouldn't we rather ensure that thelink variable is always defined?

@krzysiekpiasecki
Copy link
ContributorAuthor

Not necessarily. In principle, data profiles include a larger area, so view of the details is the expected function. Otherwise documentation differs from implementation.

@fabpot
Copy link
Member

ping@javiereguiluz

@stof
Copy link
Member

stof commentedDec 5, 2015

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 aid defined check at the beginning of the template to initialize it, which would be equivalent to this PR).
So it may make sense to simplify it (but bundle supporting 2.7 and older would always have to pass it explicitly though)

@javiereguiluz
Copy link
Member

@xabbuh I think@krzysiekpiasecki is right because according to the documentation:

  • If you say nothing, we show a link
  • If you saylink: true, we show a link
  • If you saylink: false, we don't show the link

My only comment for@krzysiekpiasecki is this one: do you think we could replace{% if link is not defined or link %} condition by{% if link|default(true) %} ?

@krzysiekpiasecki
Copy link
ContributorAuthor

Yes, you could.

@javiereguiluz
Copy link
Member

@krzysiekpiasecki if you have some more time for this, please change the condition so we can merge this. Thanks a lot!

@fabpot
Copy link
Member

Closing this one, I'm going to create a new PR on 2.3 with@javiereguiluz suggestion.

@fabpotfabpot closed thisJan 25, 2016
@fabpotfabpot mentioned this pull requestJan 25, 2016
fabpot added a commit that referenced this pull requestJan 25, 2016
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/aCommits-------4b21351 fixed undefined variable
fabpot added a commit that referenced this pull requestMar 1, 2016
…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**![debug-toolbar-link-a](https://cloud.githubusercontent.com/assets/800119/13433728/7c48c382-dfd3-11e5-8432-299bfa143647.png)**and after**![debug-toolbar-link-b](https://cloud.githubusercontent.com/assets/800119/13433732/7fd97dc0-dfd3-11e5-80c6-62c009447a2e.png)**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
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@krzysiekpiasecki@xabbuh@fabpot@stof@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp