-
-
Notifications
You must be signed in to change notification settings - Fork 139
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
PDO: Support for PDO::ERRMODE_EXCEPTION (PHP8) #394
base: master
Are you sure you want to change the base?
Conversation
45c0839
to
8881eb1
Compare
80c861c
to
26f2657
Compare
fd45178
to
e6baef8
Compare
I think it would be best to do a BC break and add support (only) for |
0efa5c1
to
0bdf956
Compare
Since it is backwards compatible, I see no reason not to include it in v4. It can be the default in v5. |
17866e0
to
82c45c3
Compare
dd46ea7
to
9e71132
Compare
I think it's a more complicated matter, see #293 |
I don't see how that's related. I do not need dibi to create me an exception. All I want is to run PDO connection in exception mode. This PR is 100% backward compatible with existing code and does not cause any breaks. It only allows PDO users to enable connection mode that throws exceptions on errors (which is what Dibi essentially does for other connection types). Without this, users are not even allowed to connect using EXCEPTION mode. What #293 is trying to solve is broken WARNING mode handling. That's not the concern of this PR. |
But exceptions also throw all other PDO methods, not just query. |
And the problem is that they would not be caught by Dibi? |
4947fa5
to
04f006a
Compare
I don't fully understand why this useful feature is still not integrated after 4 years. Came across a note in my code that works around this shortcoming, just to see nothing has been done here nor in #393 ... now there is Dibi v5 already out which only runs on PHP 8 and that means in default settings this PDO driver will simply not work. See here: https://www.php.net/manual/en/pdo.error-handling.php Because of the private-access props in the driver, there is no way to just tweak the piece of code in the constructor, so one needs to copy the whole driver. 🤦♂️ Seems like releasing a separate package with just the improved PDO driver is the way to go. |
I added support for PDO in
PDO::ERRMODE_EXCEPTION
error mode using a single try-catch block.👉 Since in PHP 8
PDO::ERRMODE_EXCEPTION
is the default error mode!