8000 [HttpFoundation] Avoid implicit null to array conversion in request matcher by ro0NL · Pull Request #20275 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[HttpFoundation] Avoid implicit null to array conversion in request matcher #20275

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
wants to merge 2 commits into from
Closed

[HttpFoundation] Avoid implicit null to array conversion in request matcher #20275

wants to merge 2 commits into from

Conversation

ro0NL
Copy link
Contributor
@ro0NL ro0NL commented Oct 22, 2016
Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets comma-separated list of tickets fixed by the PR, if any
License MIT
Doc PR reference to the documentation PR, if any

null is allowed and passed as default value from the constructor. Lets be explicit.

@ro0NL ro0NL changed the title [HttpFoundation] Avoid implicit null to string conversion in request matcher [HttpFoundation] Avoid implicit null to array conversion in request matcher Oct 22, 2016
@@ -76,13 +76,13 @@ public function __construct($path = null, $host = null, $methods = null, $ips =
*/
public function matchScheme($scheme)
{
$this->schemes = array_map('strtolower', (array) $scheme);
$this->schemes = null !== $scheme ? array_map('strtolower', (array) $scheme) : array();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really needed though. Confused with (array) null actually converting to an empty array, not something like array(null) :)

@Tobion
Copy link
Contributor
Tobion commented Oct 22, 2016

👍

@javiereguiluz
Copy link
Member

👍

(failing tests are unrelated)

@fabpot
Copy link
Member
fabpot commented Nov 7, 2016

Good catch, thanks @ro0NL.

fabpot added a commit that referenced this pull request Nov 7, 2016
… in request matcher (ro0NL)

This PR was squashed before being merged into the 2.7 branch (closes #20275).

Discussion
----------

[HttpFoundation] Avoid implicit null to array conversion in request matcher

| Q | A |
| --- | --- |
| Branch? | 2.7 |
| Bug fix? | yes |
| New feature? | no |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | comma-separated list of tickets fixed by the PR, if any |
| License | MIT |
| Doc PR | reference to the documentation PR, if any |

`null` is allowed _and_ passed as default value from the constructor. Lets be explicit.

Commits
-------

a2c0a78 [HttpFoundation] Avoid implicit null to array conversion in request matcher
@fabpot fabpot closed this Nov 7, 2016
@ro0NL ro0NL deleted the http-foundation/request-matcher-nullables branch November 18, 2016 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0