1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-12 17:54:44 +02:00
This commit is contained in:
Ryan Cramer
2022-01-07 14:01:20 -05:00
parent 85e0501988
commit 38506eb6dc
3 changed files with 4 additions and 4 deletions

View File

@@ -3927,7 +3927,7 @@ class Sanitizer extends Wire {
$str = ltrim($str, '-');
}
if(stripos($str, 'E-') && preg_match('/^([0-9., ]+\d)(E\-\d+)/i', $str, $m)) {
if((stripos($str, 'E-') || stripos($str, 'E+')) && preg_match('/^([0-9., ]+\d)(E[-+]\d+)/i', $str, $m)) {
$str = $m[1];
$append = $m[2];
}
@@ -3984,7 +3984,7 @@ class Sanitizer extends Wire {
if($options['getString']) {
if($options['precision'] === null) {
$value = strpos($value, 'E-') ? rtrim(sprintf('%.20f', (float) $value), '0') : "$value";
$value = strpos($value, 'E-') || strpos($value, 'E+') ? rtrim(sprintf('%.20f', (float) $value), '0') : "$value";
} else {
$value = sprintf('%.' . $options['precision'] . 'f', (float) $value);
}