Nicolas Roeser 76a3cf95b7 MDL-64975 moodlelib: fix float formatting if decsep is ~ (tilde)
Commit 637da99edbd7258fae20374ed8c890a167f40d30 has introduced changes
for removing trailing zeroes from the output of function format_float.
Due to a small omission, the function causes a PHP warning when the
string decsep is set to a tilde character ('~'). This is rarely the
case.

The bug lies in using PHP function preg_replace with a string that
contains external input (in this case, including decsep), but without
escaping it for PCRE processing.

This commit fixes the function to also support a tilde character in
string decsep. It also adds tests for having tilde as decimal separator.

Thanks-To:  Jake Dallimore <jake@moodle.com>
2019-06-14 13:05:39 +02:00
..