-
Notifications
You must be signed in to change notification settings - Fork 7.8k
PdoPgsql::setNoticeCallback() #14299
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
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.
Sorry, I didn't think of those new classes.
I have a suggestion on how to simplify this.
Also: the CI currently fails because the stub isn't regenerated into the arginfo file. That usually happens automatically when you do make
. You can force it manually by doing: ./build/gen_stub.php
.
7fe2959
to
35c0216
Compare
@nielsdos wrote:
Yes, it's not the first time I got caught by the CI :( |
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 quick followup! Please update the UPGRADING note + maybe a dedicated test for PdoPgsql:: setNoticeCallback()
would be useful to have. And then I guess it is good to go.
35c0216
to
6dee3db
Compare
@kocsismate wrote:
Something like "Added PdoPgsql::setNoticeCallback() / PDO::pgsqlSetNoticeCallback to allow […]"?
Here it is, with 6dee3db. |
6240ee8
to
45fdd2b
Compare
Exactly :) |
3e76414
to
79f5ddb
Compare
We're good to go after retriggering Travis CI (which has a timeout of 50 mn on a 45 mn+ job…)! Still, there's the egg-and-chicken question of how to make PdoPgsql::Xxx the official entry point, while letting PDO::pgsqlXxx available until connect becomes mainstream (and I think third parties already switched to not subclassing PDO anymore, but proxying it). |
I would only add support for PdoPgsql::Xxx and then only think about adding a PDO::pgsqlXxx version if someone offered to pay me something like £10k
You're testing a DB specific method. It's fine to hard code the class name. (it is possible you might get a more useful answer from someone not quite as in a mood as myself) |
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.
Missing tests, and I still believe we should not be adding new "magic" driver methods to the core PDO class.
@Danack wrote:
See my reply in the conversation. |
79f5ddb
to
5b4b012
Compare
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.
Thank you for your work, I believe this is now much better than the original solution was with the 2 methods. :) I mean, I agree with Dan and George, let's not add anything to the old and clunky API. Unfortunately, I didn't realize the importance of this when I first reviewed the PR.
9146226
to
e0de4b1
Compare
9146226
to
de058b4
Compare
Sorry, my fault. I also forgot to update them yesterday :( |
de058b4
to
f826ab6
Compare
d5e07c8
to
f826ab6
Compare
Unless I'm mistaken, you're still missing a test where you test that a trampoline does not leak on an uninitialized pdo instance? |
@nielsdos wrote:
OK, I'm not familiar at all with how to test that.
Is that right? But I see no "Trampoline for" in the output: are we just testing the |
What you've done so far is right, but you should also test the set method on an uninitialized PDO instance. |
Make the newly implemented setNoticeCallback() officially exposed (php#6764)
based on PDO::pgsqlSetNoticeCallback()'s one
php@c265b90#r142275842 Redefines PDO_CONSTRUCT_CHECK to make room for an optional cleanup
Keep only Pdo\Pgsql::setNoticeCallback()
f826ab6
to
fe2b24d
Compare
@nielsdos wrote:
I almost had it 😞, in a commented, uncommited part of my local
On a theorical point of view, is there a difference between |
4bbed47
to
fe2b24d
Compare
Add a test with a runtime BadMethodCallException. Streamline issue78621_method.phpt.
fe2b24d
to
7d100a4
Compare
Thanks for the test!
It is equivalent, the properties are initialized when the object is allocated before calling the constructor. In case no constructor is called the properties are initialized. I think the patch looks good. @Girgias I believe all cases are now covered. |
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.
Thank you! Looks good to me now :)
/* Do NOT add new methods here. See https://wiki.php.net/rfc/pdo_driver_specific_subclasses | ||
* Any new feature should be declared only on Pdo\Pgsql. | ||
*/ |
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.
This might make sense to add to other drivers in a follow-up PR.
Make the newly implemented setNoticeCallback() officially exposed in @kocsismate / @Danack Pdo\Pgsql (discussion begun at #6764)