Re: [PHP-DEV] Make bcmath functions more strict

2019-04-26 Thread Nikita Popov
On Fri, Apr 26, 2019 at 3:10 PM Benjamin Morel wrote: > > Yes, PHP 8 for BCs and PHP 7.4 for warnings that's what I was trying to > said > > FWIW, I don't think anyone will complain about adding a warning to > something that's obviously a bug when it fails. > I'd say go ahead a write an RFC. If y

Re: [PHP-DEV] Make bcmath functions more strict

2019-04-26 Thread Benjamin Morel
> Yes, PHP 8 for BCs and PHP 7.4 for warnings that's what I was trying to said FWIW, I don't think anyone will complain about adding a warning to something that's obviously a bug when it fails. I'd say go ahead a write an RFC. If you want to have more chances for it to pass though, I would not cha

Re: [PHP-DEV] Make bcmath functions more strict

2019-04-26 Thread Vladyslav Startsev
> Another option might be to introduce an object-oriented layer on top of > libbcmath I think it should be a separate discussion for this. Create new discussion so we can talk there. >> Throwing an exception would be rather uncommon for functions, and would >> definitely have to wait for PHP 8 f

Re: [PHP-DEV] Make bcmath functions more strict

2019-04-26 Thread Benjamin Morel
> Throwing an exception would be rather uncommon for functions, and would > definitely have to wait for PHP 8 for BC reasons. Sure. This is actually a discussion I'd like to start for all PHP functions in PHP 8. >Another option might > be to introduce an object-oriented layer on top of libbcmath.

Re: [PHP-DEV] Make bcmath functions more strict

2019-04-26 Thread Christoph M. Becker
On 26.04.2019 at 09:45, Benjamin Morel wrote: >> I don't really understand it, I must be strict, converting to zero >> will lead to wrong calculations. > > That's what I said :) Fully agree here, any non-numeric string should throw > an exception. > > In summary, I would check that the string matc

Re: [PHP-DEV] Make bcmath functions more strict

2019-04-26 Thread Benjamin Morel
Hi Vladyslav, > I don't really understand it, I must be strict, converting to zero > will lead to wrong calculations. That's what I said :) Fully agree here, any non-numeric string should throw an exception. In summary, I would check that the string matches ` /^[\+\-]?[0-9]+(\.[0-9]+)?$/`or else

Re: [PHP-DEV] Make bcmath functions more strict

2019-04-25 Thread Vladyslav Startsev
On Thu, Apr 25, 2019 at 12:35 PM Benjamin Morel wrote: > > Hi Vladyslav, > > I just checked your code snippet, here are my 2 cents: > > - bcmath should definitely trigger an error when encountering a malformed > string like '17 .123', silently converting it to zero is indeed the worth > thing to

Re: [PHP-DEV] Make bcmath functions more strict

2019-04-25 Thread Benjamin Morel
Hi Vladyslav, I just checked your code snippet, here are my 2 cents: - bcmath should definitely trigger an error when encountering a malformed string like '17 .123', silently converting it to zero is indeed the worth thing to do; - I don't think that there's much value in having it handle exponen

Re: [PHP-DEV] Make bcmath functions more strict

2019-04-25 Thread Vladyslav Startsev
Any other ideas on that one? I'll wait for one more week and make RFC then -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Make bcmath functions more strict

2019-02-12 Thread Legale.legale
Hello Vlad, internals. If you'll make an RFC someone will certainly vote :-) Meanwhile till php bureaucracy hasn't put quorum rule in the voting process you have a chance to push it through. Good luck.

Re: [PHP-DEV] Make bcmath functions more strict

2019-02-12 Thread Vladyslav Startsev
On Fri, Feb 8, 2019 at 1:07 AM Ben Ramsey wrote: > > > On Feb 7, 2019, at 11:47, Vladyslav Startsev > > 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

Re: [PHP-DEV] Make bcmath functions more strict

2019-02-07 Thread Ben Ramsey
> On Feb 7, 2019, at 11:47, Vladyslav Startsev > 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 twitt

[PHP-DEV] Make bcmath functions more strict

2019-02-07 Thread Vladyslav Startsev
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