Re: Changing the default PDO error mode
| From: | Christian Schneider | Date: | Thu, 19 Mar 2020 12:25:34 +0000 |
| Subject: | Re: Changing the default PDO error mode | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109144@lists.php.net to get a copy of this message | ||
Am 19.03.2020 um 10:31 schrieb Matteo Beccati <php@beccati.com>:
> 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.
I think this should go through a deprecation phase first as it is a BC break, no matter how easy to
fix you think it is.
- Chris