-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix the default value of $ctorArgs param in PDOStatement::fetchObject() #6937
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
Conversation
sorry, I forgot to push my changes. Did I get it right that the behavior differs when the |
My first thought: I think an empty array is an acceptable compromise. We can add a note in the manual about the unexpected behaviour with the default and temporary arguments but the signature can remain as an empty array. After thought: Can we change the code and make the parameter nullable? It looks like it was meant to be nullable. What would that take? |
IMO the stubs need to be an authoritative source of truth. Nikita even made tests which replaces default params with the ones in the stub: #5366
we didn't do this in case of #6933 for BC, although in case of PDOStatement::fetchObject() we would have more reason. |
I'm missing some context here, what is the reason for this change? |
I've just referenced the PR where the issue came up (generating PDO methodsynopses for the doc). |
IIRC all other cases which accept a constructor arguments (in the overloaded methods) accept |
Okay, so why doesn't this simply change the implementation to make the parameter actually nullable? |
Due to the discussion in case of PDOStatement::fetch(), I didn't "dare" to change the signature. But I agree that it's the best course of action, and that's what I'd also prefer. |
@kocsismate You wouldn't be changing the signature though. The signature is as declared in stubs, and that's the one that currently applies to inheriting code. There should be no BC impact from fixing the implementation. |
oh, you are right. I'm messing up things today... |
It's more than one line of change due to the way this method is implemented. If you make it nullable you would get memory leaks as far as I can see. |
I'll add a test for this, and I'll work on this later. |
@nikic Do we need to backport the memory leak fix to PHP 7.4? |
It looks like we don't have a real default value :(