Open
Description
Setup:
- ProcessWire latest
- PHP 7.4 (!)
- Using locale where decimal separator is a comma (not a dot), e.g. de_DE.utf8
- Field with FieldtypeDecimal (core), configured with 2 decimals
When trying to save a page with the (changed) decimal field in admin, I get the error
Warning: 1265 Data truncated for column 'data' at row 1
The new value is not saved. The error does not occur on PHP >= 8.0
The problem seems to be here:
After this line, the string $value has a decimal comma (instead of a dot).
For my use case, I could fix it by replacing this line with
$value = stripos("$value", 'E') ? rtrim(sprintf("%.15$f", (float) $value), '0') : number_format($value, 2, '.', '');
But there might be <> 2 decimals...