Skip to content

Commit

Permalink
Result::normalize() Fix select float in format of e-notation (dg#317)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chrudos Vorlicek committed Oct 23, 2018
1 parent 69ea60c commit 66770a1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Dibi/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,11 @@ private function normalize(array &$row)
} elseif ($type === Type::FLOAT) {
$value = ltrim((string) $value, '0');
$p = strpos($value, '.');
if ($p !== false) {
$e = strpos($value, 'e');
if ($p !== false && $e === false) {
$value = rtrim(rtrim($value, '0'), '.');
} elseif ($p !== false && $e !== false) {
$value = rtrim($value, '.');
}
if ($value === '' || $value[0] === '.') {
$value = '0' . $value;
Expand Down

0 comments on commit 66770a1

Please sign in to comment.