Re: Deprecate PDO::ATTR_ERRMODE [Proposed RFC]
| From: | Larry Garfield | Date: | Wed, 06 Sep 2023 16:43:42 +0000 |
| Subject: | Re: Deprecate PDO::ATTR_ERRMODE [Proposed RFC] | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120995@lists.php.net to get a copy of this message | ||
On Wed, Sep 6, 2023, at 2:53 PM, Kamil Tekiela wrote:
>>Do you think there is still demand for such error mode control features?
>>
>>Personally, I've never seen anyone prefer silent mode, so I think it's worth
>>making the drastic change.
>
> This may be right. There isn't a demand for this in **new** code and I
> doubt anyone would come forward with a reason to use silent mode now.
> However the purpose of keeping this mode is to enable old legacy code
> to run without major refactoring. This is the practice coming from the
> days before PHP 5 when using exceptions wasn't common. Plenty of
> applications are still running code designed 20 years ago because PHP
> keeps as much backward compatibility as possible. The code would
> benefit from modernization, but this would require a lot of effort
> from its maintainers.
>
> We may get away with deprecating and removing PDO silent/warning mode
> because it's an extension that was introduced in PHP 5 and everyone
> was on board with using exception mode. We probably cannot remove
> silent mode for other extensions that either mimic older extensions
> that didn't use exceptions (e.g. mysqli) or have been introduced
> before PHP 5. The reason is that people designed their code using
> silent mode and removing it now would cause some serious headaches.
>
> Another point to consider is that PDO had silent mode as default for a
> long time. You may be surprised, but many people weren't aware that it
> can throw exceptions. My guess is that's a very small proportion of
> all projects though. With PHP 8.0, they just slapped one line of code
> and called it a day. Having said that, I think removing PDO's silent
> mode is possible soon, even in PHP 9.0, but we may anger some people.
>
> All warning modes can be deprecated in PHP 8.4 and removed in PHP 9.0.
> Silent mode of other extensions should be carefully reviewed one by
> one. Deprecation in PHP 9.0 and removal in PHP 10.0 might be a better
> option.
I would also be fine with deprecating and removing the old/useless error modes, but only if
there's a long enough deprecation period. I question if 8.4->9 would be sufficient.
I'd be more comfortable with deprecating them now and removing in 10.
--Larry Garfield