Re: Make bcmath functions more strict
| From: | Benjamin Morel | Date: | Fri, 26 Apr 2019 07:45:56 +0000 |
| Subject: | Re: Make bcmath functions more strict | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-105454@lists.php.net to get a copy of this message | ||
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 throw an exception.
- Ben