[RFC] Change default PDO error mode

php.internals

AllenJB

6 years ago
Hi, I present for discussion an RFC to change the default PDO error mode: https://wiki.php.net/rfc/pdo_default_errmode Previous discussion: https://externals.io/message/109015 I believe this change will help new developers who are presently presented only with knock-on errors, which can be confusing, when using PDO unless they implement "boilerplate" error handling every time a query is made. I believe it also brings the behavior inline with what developers would actually expect the default to be in modern PHP. Regards, AllenJB

Paul M. Jones

6 years ago
Hi there,
> On Mar 28, 2020, at 14:02, AllenJB <php.lists@allenjb.me.uk> wrote: > > I believe it also brings the behavior inline with what developers would actually expect the default to be in modern PHP.
As do I. Every PDO wrapper I've ever written, one of the first things it does is set exceptions as the error mode.
-- Paul M. Jones pmjones@pmjones.io http://paul-m-jones.com Modernizing Legacy Applications in PHP https://leanpub.com/mlaphp Solving the N+1 Problem in PHP https://leanpub.com/sn1php

Matteo Beccati

6 years ago
Hi Allen, +1 from me. If you need some help with the implementation, pls let me know. Cheers On 28/03/2020 20:02, AllenJB wrote:
> Hi, > > I present for discussion an RFC to change the default PDO error mode: > > https://wiki.php.net/rfc/pdo_default_errmode > > Previous discussion: https://externals.io/message/109015 > > I believe this change will help new developers who are presently > presented only with knock-on errors, which can be confusing, when using > PDO unless they implement "boilerplate" error handling every time a > query is made. > > I believe it also brings the behavior inline with what developers would > actually expect the default to be in modern PHP. > > Regards, > > AllenJB >
-- Matteo Beccati Development & Consulting - http://www.beccati.com/

Andrew Faulds

6 years ago
Hi, AllenJB wrote:
> I present for discussion an RFC to change the default PDO error mode: > > https://wiki.php.net/rfc/pdo_default_errmode
A good thing about this RFC is that if you prefer the traditional error mode and need to keep that behaviour working in whatever new PHP version hypothetically implements this RFC, adding the call to set the error mode will not make your code incompatible with previous PHP versions, which means it should be tolerable for the authors of libraries or other software packages. :) Thanks, Andrea

AllenJB

6 years ago
Hi all, A quick "bump" to make sure everyone's seen this RFC amongst all the other exciting discussions that are going on. I'm hoping the lack of discussion means this is a boring obvious change that everyone's going to vote 'yes' to. With the lack of any raised concerns or issues, I intend to open voting this weekend. Regards, AllenJB On 28/03/2020 19:02, AllenJB wrote: