-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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
[Bridge] [Doctrine] Normalize params only when used. [2.3] #17364
Conversation
👍 |
if (null !== $this->logger) { | ||
$this->log($sql, null === $params ? array() : $params); | ||
$this->log($sql, null === $params ? array() : $this->normalizeParams($params)); |
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.
What if $params
is no array (this was checked before)?
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.
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
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.
What I mean is that $params
can indeed be null
here but normalizeParams()
doesn't handle null
.
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.
if $params
is null
it is not given to normalizeParams
, I'm not sure if I follow?
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.
Oh sorry, I missed the null === $params
check.
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.
👍 thanks for the review :)
👍 Status: Reviewed |
Thank you @SpacePossum. |
…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.
If no logger is set the params are not used so those don't have to be normalized.