-
Notifications
You must be signed in to change notification settings - Fork 111
Wrong decimal number in atk4_money type typecast #2234
Copy link
Copy link
Closed
Labels
Description
Following the ATK4 Discord Help conversation, here is the summary:
- Store a value, e.g., -172158.01 in an atk4_money field.
- It is wrongly typecasted as € -172.158,01000000001
Reason is that
Line 132 in a441238
| $valueDecimals = strlen(preg_replace('~^[^.]$|^.+\.|0+$~s', '', number_format($value, max(0, 11 - (int) log10($value)), '.', ''))); |
Here is an alternative calculation of $valueDecimals for that given line which is working:
$valueDecimals = ($decimalPos = strrchr((string) $value, '.')) ? strlen($decimalPos) -1 : 0;
Reactions are currently unavailable