mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 08:17:12 +02:00
Additional update for processwire/processwire-issues#1502
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.8",
|
"php": ">=5.5",
|
||||||
"ext-gd": "*"
|
"ext-gd": "*"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@@ -3927,7 +3927,7 @@ class Sanitizer extends Wire {
|
|||||||
$str = ltrim($str, '-');
|
$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];
|
$str = $m[1];
|
||||||
$append = $m[2];
|
$append = $m[2];
|
||||||
}
|
}
|
||||||
@@ -3984,7 +3984,7 @@ class Sanitizer extends Wire {
|
|||||||
|
|
||||||
if($options['getString']) {
|
if($options['getString']) {
|
||||||
if($options['precision'] === null) {
|
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 {
|
} else {
|
||||||
$value = sprintf('%.' . $options['precision'] . 'f', (float) $value);
|
$value = sprintf('%.' . $options['precision'] . 'f', (float) $value);
|
||||||
}
|
}
|
||||||
|
@@ -117,7 +117,7 @@ class InputfieldFloat extends InputfieldInteger {
|
|||||||
$attributes['step'] = '.' . ($precision > 1 ? str_repeat('0', $precision - 1) : '') . '1';
|
$attributes['step'] = '.' . ($precision > 1 ? str_repeat('0', $precision - 1) : '') . '1';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($attributes && isset($attributes['value']) && strpos($attributes['value'], 'E-')) {
|
if($attributes && isset($attributes['value']) && stripos($attributes['value'], 'E')) {
|
||||||
$attributes['value'] = $this->wire()->sanitizer->float($attributes['value'], array(
|
$attributes['value'] = $this->wire()->sanitizer->float($attributes['value'], array(
|
||||||
'getString' => true,
|
'getString' => true,
|
||||||
));
|
));
|
||||||
|
Reference in New Issue
Block a user