Re: Changing the default PDO error mode
| From: | Christoph M. Becker | Date: | Thu, 19 Mar 2020 12:52:58 +0000 |
| Subject: | Re: Changing the default PDO error mode | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109145@lists.php.net to get a copy of this message | ||
On 19.03.2020 at 13:25, Christian Schneider wrote:
> 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.
As I understand it, the proposal is to *change* the default setting, not
to (eventually) remove any of the currently available modes. Are you
suggesting to deprecate using the default; in other words, require users
to explicitly set PDO::ATTR_ERRMODE?
--
Christoph M. Becker