dibi
dibi copied to clipboard
PDO: Support for PDO::ERRMODE_EXCEPTION (PHP8)
- new feature, no existing code will break (full bc)
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!
I think it would be best to do a BC break and add support (only) for PDO::ERRMODE_EXCEPTION in dibi 5.0 and keep version 4.2 as it is. What do you think?
Since it is backwards compatible, I see no reason not to include it in v4. It can be the default in v5.
👉 PR #393 is open for v4 branch.
bump.
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? I think users would be better off with native PDO exceptions than not being able to use the exception mode.