Issue Bug Closed

#75920Extbase generic persistence casting float value to string causes wrong values if system locale is german

Philipp Wrann 04/26/16, 10:34 updated 04/26/16, 10:37

Description

When setting a float property to 45.5 and persisting it via extbase on a system with locale=de the resulting string will be 45,5, that results in a stored value of 45.0 in the database.

this should be taken into account explicitly in the ObjectMapper::getPlainValue method.

If the input is of type float, we may have to string replace comma by dots or use some Utility class to cast the float value.

number_format($value, $precision, “.”, “”) could also do the job, to get the precision the sql would have to be evaluated when building the column map, so maybe str_replace(“,”, “.”, (string) $value) would be the easiest solution.

My system runs php5.6 and system locale is de_DE.UTF-8

I will install the german locale also on production machine to enable german date formats etc. So this is gonna be a problem.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.