summaryrefslogtreecommitdiffstats
path: root/system/database/DB_query_builder.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-11-20 20:18:08 +0100
committerAndrey Andreev <narf@bofh.bg>2012-11-20 20:18:08 +0100
commit3a5efc291ac17a8a9886be25f6b430796969d154 (patch)
treefd1489bf5117bf2d8b08c0f6ee2282e9ad869e9d /system/database/DB_query_builder.php
parentd337a2621d36aebd0747b4e10a61b98bb13a2793 (diff)
Fix issue #2015
Diffstat (limited to 'system/database/DB_query_builder.php')
-rw-r--r--system/database/DB_query_builder.php17
1 files changed, 8 insertions, 9 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 3154d148b..9bd535b0e 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -644,17 +644,11 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
? $this->_group_get_type('')
: $this->_group_get_type($type);
- if (is_null($v) && ! $this->_has_operator($k))
- {
- // value appears not to have been set, assign the test to IS NULL
- $k .= ' IS NULL';
- }
-
if ( ! is_null($v))
{
if ($escape === TRUE)
{
- $v = ' '.(is_int($v) ? $v : $this->escape($v));
+ $v = ' '.$this->escape($v);
}
if ( ! $this->_has_operator($k))
@@ -662,6 +656,11 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$k .= ' = ';
}
}
+ elseif ( ! $this->_has_operator($k))
+ {
+ // value appears not to have been set, assign the test to IS NULL
+ $k .= ' IS NULL';
+ }
$this->{$qb_key}[] = array('condition' => $prefix.$k.$v, 'escape' => $escape);
if ($this->qb_caching === TRUE)
@@ -2540,7 +2539,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
{
$str = trim($str);
- if (empty($str))
+ if (empty($str) OR ctype_digit($str) OR (string) (float) $str === $str OR in_array(strtoupper($str), array('TRUE', 'FALSE'), TRUE))
{
return TRUE;
}
@@ -2553,7 +2552,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
? array('"', "'") : array("'");
}
- return (ctype_digit($str) OR in_array($str[0], $_str, TRUE));
+ return in_array($str[0], $_str, TRUE);
}
// --------------------------------------------------------------------