Re: Make bcmath functions more strict
| From: | Ben Ramsey | Date: | Thu, 07 Feb 2019 23:07:41 +0000 |
| Subject: | Re: Make bcmath functions more strict | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-104297@lists.php.net to get a copy of this message | ||
> On Feb 7, 2019, at 11:47, Vladyslav Startsev <vladyslavstartsev@gmail.com> wrote:
>
> Hello everyone!
>
> Recently I noticed that there are strange behavior going on if I use
> bcmath functions (some examples you can see here
> https://3v4l.org/D3s7J). I also previously had little
> discussion with
> Sara Golemon on twitter about this
> (https://twitter.com/SaraMG/status/1087902930110480384). So to
> conclude things that I want, is drop behavior (they should throw
> invalid argument exception) that I've showed in the first link and as
> Sara suggested add deprecation warning (but I think it should be
> E_NOTICE level errors) in 7.4.
Another option to consider is to adopt the same approach as standard
math in PHP. Here’s an example using standard addition for the same
values: https://3v4l.org/iMGg8
So, maybe it should emit notices and warnings instead?
Notice: A non well formed numeric value encountered in…
Warning: A non-numeric value encountered in…
Cheers,
Ben
Attachment: [application/pgp-signature] Message signed with OpenPGP signature.asc
Attachment: [application/pgp-signature] Message signed with OpenPGP signature.asc