Re: [PHP-DEV] Deprecate PDO::ATTR_ERRMODE [Proposed RFC]

2023-09-06 Thread Larry Garfield
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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php



Re: [PHP-DEV] Deprecate PDO::ATTR_ERRMODE [Proposed RFC]

2023-09-06 Thread Saki Takamachi
> 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 see.
Certainly, it seems necessary to consider the silent mode of other extensions 
enough. Agree.

This was originally a proposal to solve the situation where PDO's error mode 
behavior was not well maintained.

There are problems such as warnings being displayed even in silent mode, and 
correct information not being obtained using PDO::errorInfo.

It seems like a good option would be to keep all silent modes and deprecate 
warning mode in 8.4 and remove it in 9.x.
And it seems good to fix PDO's silent mode bug in 8.4.

What do you think?

Regards.

Saki
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php



Re: [PHP-DEV] Deprecate PDO::ATTR_ERRMODE [Proposed RFC]

2023-09-06 Thread Kamil Tekiela
>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.

Regards,
Kamil

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php



Re: [PHP-DEV] Deprecate PDO::ATTR_ERRMODE [Proposed RFC]

2023-09-06 Thread Saki Takamachi
> However, if we are going to remove it, it would be nice to have this done 
> consistently across all bundled extensions.

Thank you for confirmation.

This is probably not technically difficult, but it does increase the scope of 
change. However, as you say, the specifications should be unified.

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.

regards.

Saki
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php



Re: [PHP-DEV] Deprecate PDO::ATTR_ERRMODE [Proposed RFC]

2023-09-06 Thread G. P. B.
On Tue, 29 Aug 2023 at 14:52, Saki Takamachi  wrote:

> Hi, internals.
>
> I thought about various things to improve the current situation where
> `PDO::ATTR_ERRMODE` is not working very smartly.
>
> Exceptions may be thrown regardless of the setting of `PDO::ATTR_ERRMODE`.
> https://www.php.net/manual/en/pdo.rollback.php#refsect1-pdo.rollback-errors
>
> Another annoyance is that `PDO::ERRMODE_SILENT` sometimes gives a warning.
> This is an undocumented phenomenon, and it's a 19-year-old vintage bug.
>
> https://github.com/php/php-src/blob/223fb08819967b3063610289a5783944a85d6d65/ext/pdo/pdo_dbh.c#L74
>
> Based on these, I feel that the reliability of the attribute value
> PDO::ATTR_ERRMODE is low and there is not much meaning in its existence as
> an attribute value.
>
> Since the default behavior became `PDO::ERRMODE_EXCEPTION` in PHP8.0.0, I
> think it would be better to abolish it rather than leave it halfway.
>
> I think this is a big change, so I'm assuming 9.x+ even if it's
> implemented.
> I will do the implementation myself.
>
> Please let me know what you think.
> Thank you.
>
> Saki
>

I don't know about removing the silent mode altogether, but I think the
warning version is pretty useless.
However, if we are going to remove it, it would be nice to have this done
consistently across all bundled extensions.
>From the top of my head, I know SQLite3 and the Intl extension also have
such flags, and possibly the DOM extension too.

Best regards.

George P. Banyard


Re: [PHP-DEV] Deprecate PDO::ATTR_ERRMODE [Proposed RFC]

2023-09-05 Thread Saki Takamachi
Does anyone have any opinions regarding this matter?
If there is no response after waiting for a certain period of time, I will 
start preparing an RFC.

Saki
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php



[PHP-DEV] Deprecate PDO::ATTR_ERRMODE [Proposed RFC]

2023-08-29 Thread Saki Takamachi
Hi, internals.

I thought about various things to improve the current situation where 
`PDO::ATTR_ERRMODE` is not working very smartly.

Exceptions may be thrown regardless of the setting of `PDO::ATTR_ERRMODE`.
https://www.php.net/manual/en/pdo.rollback.php#refsect1-pdo.rollback-errors

Another annoyance is that `PDO::ERRMODE_SILENT` sometimes gives a warning.
This is an undocumented phenomenon, and it's a 19-year-old vintage bug.
https://github.com/php/php-src/blob/223fb08819967b3063610289a5783944a85d6d65/ext/pdo/pdo_dbh.c#L74

Based on these, I feel that the reliability of the attribute value 
PDO::ATTR_ERRMODE is low and there is not much meaning in its existence as an 
attribute value.

Since the default behavior became `PDO::ERRMODE_EXCEPTION` in PHP8.0.0, I think 
it would be better to abolish it rather than leave it halfway.

I think this is a big change, so I'm assuming 9.x+ even if it's implemented.
I will do the implementation myself.

Please let me know what you think.
Thank you.

Saki
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php