From 2c9cbe9b0c3f47916ef428669ec52f864cdf6f76 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Wed, 3 Apr 2013 14:38:12 +0200 Subject: [PATCH] DibiResult: fixed detection of "123.000" as float [Closes #67] --- dibi/libs/DibiResult.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dibi/libs/DibiResult.php b/dibi/libs/DibiResult.php index 22b16d83..7b25f1a9 100644 --- a/dibi/libs/DibiResult.php +++ b/dibi/libs/DibiResult.php @@ -532,7 +532,7 @@ class DibiResult extends DibiObject implements IDataSource $row[$key] = is_float($tmp = $value * 1) ? $value : $tmp; } elseif ($type === dibi::FLOAT) { - $row[$key] = (string) ($tmp = (float) $value) === $value ? $tmp : $value; + $row[$key] = (string) ($tmp = (float) $value) === rtrim(rtrim($value, '0'), '.') ? $tmp : $value; } elseif ($type === dibi::BOOL) { $row[$key] = ((bool) $value) && $value !== 'f' && $value !== 'F';