Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[DependencyInjection] Yaml: check if $tags is an array before using it#21348
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
dunglas commentedJan 19, 2017
| Q | A |
|---|---|
| Branch? | master |
| Bug fix? | yes |
| New feature? | no |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | n/a |
| License | MIT |
| Doc PR | n/a |
| } | ||
| } | ||
| $tags =isset($service['tags']) ?$service['tags'] :array(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think this line was fine, just addif (!is_array($tags)) { on the next line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
shouldn't this PR be applied on a lower branch btw?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Why not but it adds 1 useless check when$service['tags'] is not set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
No the branch is correct (this "bug" was introduced by_defaults in#21071).
nicolas-grekasJan 19, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
it adds 1 useless check
yes, but we don't care, readibility is more important here (thinking about the complexity of nested if/else blocks) IMHO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I usually preferif/else than the ternary operator but it's probably because I need glasses to read on a screen.
I'll change that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
done
xabbuh commentedJan 19, 2017
We should add a test then to avoid future regressions. |
dunglas commentedJan 20, 2017
@xabbuh test added |
nicolas-grekas commentedJan 20, 2017
Tests fail :) |
dunglas commentedJan 20, 2017
Fixed. |
xabbuh left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
👍
Status: Reviewed
| Foo\Bar: | ||
| tags:invalid | ||
| inherit_tags:true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I find this test confusing. Intuitively, I thought that tags were inherited and then validated, so theFoo\Bar service has the validtags: ['foo'] tags instead oftags: invalid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
But this way (using a string instead of an array) to specify tags already wasn't supported before. Why should we do that now?
nicolas-grekas commentedJan 24, 2017
Thank you@dunglas. |
…efore using it (dunglas)This PR was squashed before being merged into the 3.3-dev branch (closes#21348).Discussion----------[DependencyInjection] Yaml: check if $tags is an array before using it| Q | A| ------------- | ---| Branch? | master| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | n/a| License | MIT| Doc PR | n/aCommits-------1c9b5c9 [DependencyInjection] Yaml: check if is an array before using it