freshworkstudio / ChileanBundle

A PHP composer package with Chilean validations, common variables, etc. (RUT, IVA, ETC). Ready for Laravel 5. Grande chile ctm :)
MIT License
92 stars 11 forks source link

[2022-09-02 15:00:14] laravel.WARNING: Implicit conversion from float 6.6666666E-62 to int loses precision #13

Open JoseLuis21 opened 2 years ago

JoseLuis21 commented 2 years ago

Laravel Logs version 9 WARNING [2022-09-02 15:00:14] laravel.WARNING: Implicit conversion from float 6.6666666E-62 to int loses precision in /home/www/vendor/freshwork/chilean-bundle/src/Rut.php on line 247

JoseLuis21 commented 2 years ago

Esta es la solución

public function calculateVerificationNumber() { $rut = $this->number; $s=1; for ($m=0; $rut != 0; $rut /= 10) { $rut_porcentaje = (int)$rut%(int)10; $nine = ((int)9-(int)$m++%(int)6); $s=(((int)$s+$rut_porcentaje*($nine))%(int)11); } return chr($s?$s+47:75); }