# [RFC] Change default PDO error mode

- Thread: https://externals.io/message/109398
- Original archive: https://news-web.php.net/php.internals/109398
- Started by AllenJB on 2020-03-28T19:02:22+00:00
- Messages: 5
- RFC: Change default PDO error mode (Implemented (PHP 8.0)) — https://externals.io/rfc/pdo_default_errmode.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #109398 — AllenJB — 2020-03-28T19:02:22+00:00

URL: https://externals.io/message/109398#109398

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

---

## #109399 — Paul M. Jones — 2020-03-28T19:15:39+00:00

URL: https://externals.io/message/109398#109399 · In reply to: #109398

Hi there,

> 
> 
> 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

---

## #109492 — Matteo Beccati — 2020-04-01T07:18:40+00:00

URL: https://externals.io/message/109398#109492 · In reply to: #109398

Hi Allen,

+1 from me. If you need some help with the implementation, pls let me know.


Cheers


> 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/

---

## #109526 — Andrea Faulds — 2020-04-03T21:23:26+00:00

URL: https://externals.io/message/109398#109526 · In reply to: #109398

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

---

## #109575 — AllenJB — 2020-04-09T09:12:22+00:00

URL: https://externals.io/message/109398#109575 · In reply to: #109398

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


> 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
