Re: Changing the default PDO error mode
| From: | Matteo Beccati | Date: | Thu, 19 Mar 2020 09:31:48 +0000 |
| Subject: | Re: Changing the default PDO error mode | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109139@lists.php.net to get a copy of this message | ||
Hi,
On 14/03/2020 22:10, Larry Garfield wrote:
>> What do you think the new default be (and why)?
>>
>> (I am aware this change will likely require an RFC)
>>
>> AllenJB
>
> I see only two options:
>
> 1) Do nothing.
>
> 2) Move to Exceptions.
>
> I've never used PDO and not set it to Exceptions, honestly. Adding more global error
> conditions to code is a terrible idea, so let's not do warnings. If your query breaks, you
> really shouldn't continue because your data is busted so your following code will fail
> ungracefully at best, or corrupt data at worst.
>
> Changing a default like this seems a reasonably safe thing to do in a major, as long as
> it's still just as easy to switch back to silent mode for those who prefer to be explicit.
I agree defaulting to PDO::ERRMODE_EXCEPTION is a sensible change for PHP8.
Cheers
--
Matteo Beccati
Development & Consulting - http://www.beccati.com/