From 555336a30ff7b53dc0e3cdcb9fae30ba62d02a65 Mon Sep 17 00:00:00 2001
From: colshrapnel
Date: Fri, 11 Jan 2013 00:38:38 +0400
Subject: [PATCH] improved int placeholder formatting
---
safemysql.class.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/safemysql.class.php b/safemysql.class.php
index cb7b672..5979cec 100644
--- a/safemysql.class.php
+++ b/safemysql.class.php
@@ -472,16 +472,17 @@ class SafeMySQL
{
if (is_float($value))
{
- return number_format($value, 0, '.', ''); // may lose precision on big numbers
+ $value = number_format($value, 0, '.', ''); // may lose precision on big numbers
}
elseif(is_numeric($value))
{
- return (string)$value;
+ $value = $value;
}
else
{
$this->error("Integer (?i) placeholder expects numeric value, ".gettype($value)." given");
}
+ return " ".$value; // to avoid double munus collision (one from query + one from value = comment --)
}
private function escapeString($value)