vlucas / valitron

Valitron is a simple, elegant, stand-alone validation library with NO dependencies
BSD 3-Clause "New" or "Revised" License
1.57k stars 253 forks source link

bccomp(): bcmath function argument is not well-formed #345

Open dfrancesch opened 3 years ago

dfrancesch commented 3 years ago

Hi! I'm getting this error in vlucas\valitron\src\Valitron\Validator.php line 366 On Windows.

I think it's an issue with php version 7.4.18 (win), because on php 7.3.29 (linux) it doesn't happen.

willemwollebrants commented 3 years ago

I've done a bit of reading and you're idea seems correct: https://www.php.net/manual/en/migration74.incompatible.php "BCMath functions will now warn if a non well-formed number is passed, such as "32foo". The argument will be interpreted as zero, as before." I think we need to make sure the number is well-formed before passing it to bcmath