Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bridge] [Doctrine] Normalize params only when used. [2.3] #17364

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

Merged

Conversation

SpacePossum
Copy link
Contributor

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
License MIT

If no logger is set the params are not used so those don't have to be normalized.

@paradajozsef
Copy link
Contributor

👍

if (null !== $this->logger) {
$this->log($sql, null === $params ? array() : $params);
$this->log($sql, null === $params ? array() : $this->normalizeParams($params));
Copy link
Member

Choose a reason for hiding this comment

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

What if $params is no array (this was checked before)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If $params is not an array and not null; PHP will raise a fatal error because the function signature states array (with default null).

sth like;

PHP Catchable fatal error:  Argument 2 passed to startQuery() must be of the type array, integer given, ...

so the test for array and later on for null was overcomplete AFAIK

Copy link
Member

Choose a reason for hiding this comment

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

What I mean is that $params can indeed be null here but normalizeParams() doesn't handle null.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if $params is null it is not given to normalizeParams, I'm not sure if I follow?

Copy link
Member

Choose a reason for hiding this comment

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

Oh sorry, I missed the null === $params check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 thanks for the review :)

@xabbuh
Copy link
Member

xabbuh commented Jan 14, 2016

👍

Status: Reviewed

@fabpot
Copy link
Member

fabpot commented Jan 15, 2016

Thank you @SpacePossum.

@fabpot fabpot merged commit 6852a46 into symfony:2.3 Jan 15, 2016
fabpot added a commit that referenced this pull request Jan 15, 2016
…3] (SpacePossum)

This PR was merged into the 2.3 branch.

Discussion
----------

[Bridge] [Doctrine] Normalize params only when used. [2.3]

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

If no logger is set the params are not used so those don't have to be normalized.

Commits
-------

6852a46 Normalize params only when used.
@SpacePossum SpacePossum deleted the 2_3_fix_minor_normalize_params_only_when_used branch January 15, 2016 17:12
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