1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 08:51:34 +02:00

Merge pull request #6715 from turbo124/v5-develop

FIxes for parsing string floats
This commit is contained in:
David Bomba 2021-09-24 20:56:13 +10:00 committed by GitHub
commit b2e2210a46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,12 +61,12 @@ class Number
// convert "," to "."
$s = str_replace(',', '.', $value);
if($value < 1)
return (float)$s;
// remove everything except numbers and dot "."
$s = preg_replace("/[^0-9\.]/", '', $s);
if($s < 1)
return (float)$s;
// remove all seperators from first part and keep the end
$s = str_replace('.', '', substr($s, 0, -3)).substr($s, -3);