Re: com php-src: ext/sodium: throw exceptions instead of errors: ext/sodium/libsodium.c
| From: | Niklas Keller | Date: | Tue, 28 Nov 2017 15:44:05 +0000 |
| Subject: | Re: com php-src: ext/sodium: throw exceptions instead of errors: ext/sodium/libsodium.c | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-101179@lists.php.net to get a copy of this message | ||
2017-11-28 15:27 GMT+01:00 Christian Schneider <cschneid@cschneid.com>:
> Am 28.11.2017 um 14:17 schrieb Sebastian Bergmann <sebastian@php.net>:
> > Am 28.11.2017 um 13:56 schrieb Frank Denis:
> >> Commit: c05cbd1e775fa69ed9939796a908390f2bfb4459
> >> Author: Frank Denis <github@pureftpd.org> Tue, 28 Nov 2017
> 13:56:11 +0100
> >> Parents: c219991c77e4c68f7d62963e18a1da778de0bbe0
> >> Branches: PHP-7.2
> >>
> >> Link:
> >> http://git.php.net/?p=php-src.git;a=commitdiff;h=
> c05cbd1e775fa69ed9939796a908390f2bfb4459
> >>
> >> Log:
> >> ext/sodium: throw exceptions instead of errors
> >
> > I am very much in favor of this change. However, making such a change in
> > PHP 7.2.1 is a BC break. Any chance to get that into PHP 7.2.0?
>
> I'm wary of turning errors into exceptions because code which was
> returning a result with libsodium before (either PECL or PHP 7.2.0) - even
> though it was generating an E_WARNING/E_ERROR - now suddenly aborts with an
> exception.
>
> Even if it was put into 7.2.0 it would break code written using the PECL
> module.
> (Side-note: I see that this case was already upgrade from E_WARNING to
> E_ERROR from PECL to PHP 7.2.0. But the program keeps running with E_ERROR
> so that's IMHO an acceptable change)
>
> This reminds me of a recent email by Linus Torvalds
> https://lkml.org/lkml/2017/11/21/356 because stopping the
> program due to
> something considered dangerous is debatable.
>
> Would you still consider an exception a good idea if the minimum value for
> one of the function parameters is increased in a later version of
> libsodium? Personally I'd prefer E_ERROR/E_WARNING.
I definitely want an exception there instead of an error. For a minimum
_recommendation_ a warning would be fine, but why do you prefer an E_ERROR
over an exception?
Regards, Niklas