Re: [RFC] [Discussion] SQLite3: remove warnings, move to exceptions
| From: | Larry Garfield | Date: | Mon, 24 Oct 2022 15:52:48 +0000 |
| Subject: | Re: [RFC] [Discussion] SQLite3: remove warnings, move to exceptions | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-118878@lists.php.net to get a copy of this message | ||
On Sun, Oct 23, 2022, at 9:56 PM, BohwaZ wrote:
> Kia ora,
>
> I am proposing that the SQLite3 extension stops using warnings for
> errors and instead throws exceptions by default:
>
> https://wiki.php.net/rfc/sqlite3_exceptions
>
> Whether we just deprecate warnings first and default to exceptions, and
> then remove warnings altogether in a later version, or just disable
> warnings directly, is probably the important part of the RFC.
>
> My personal point of view is that modern code probably already have
> enabled exceptions in the class, or is transforming warnings into
> exceptions using an error handler.
>
> If not, it's relatively easy to set a exception handler to dismiss the
> new exceptions if you don't want to see them.
>
> So going throught depreciation might not be necessary, but it's open
> for discussion.
>
> Feedback is welcome :)
>
> Thanks.
As others have said, the correct, responsible way to do this would be to make it gradual and keep
warnings working until 9.0. I would recommend:
1. 8.3, enableExceptions(false) raises E_DEPRECATED.
2. 9.0 enableExceptions() defaults to true, and calling it with false is an Error. (Calling it with
true still works, but is a no-op.)
3. 10.0 Remove enableExceptions() entirely.
The behavior then only changes on major versions.
I think we already did this for PDO, didn't we? It makes sense to do it for SQLite, too.
--Larry Garfield