Created
November 22, 2013 13:59
-
-
Save narfbg/7600256 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php | |
index 1d41a19..c543e15 100644 | |
--- a/system/database/DB_query_builder.php | |
+++ b/system/database/DB_query_builder.php | |
@@ -2556,6 +2556,10 @@ abstract class CI_DB_query_builder extends CI_DB_driver { | |
{ | |
return; | |
} | |
+ elseif (in_array('select', $this->qb_cache_exists, TRUE)) | |
+ { | |
+ $qb_no_escape = $this->qb_cache_no_escape; | |
+ } | |
foreach (array_unique($this->qb_cache_exists) as $val) // select, from, etc. | |
{ | |
@@ -2563,12 +2567,23 @@ abstract class CI_DB_query_builder extends CI_DB_driver { | |
$qb_cache_var = 'qb_cache_'.$val; | |
$qb_new = $this->$qb_cache_var; | |
- foreach ($this->$qb_variable as &$qb_var) | |
+ for ($i = 0, $c = count($this->$qb_variable); $i < $c; $i++) | |
{ | |
- in_array($qb_var, $qb_new, TRUE) OR $qb_new[] = $qb_var; | |
+ if ( ! in_array($this->{$qb_variable}[$i], $qb_new, TRUE)) | |
+ { | |
+ $qb_new[] = $this->{$qb_variable}[$i]; | |
+ if ($val === 'select') | |
+ { | |
+ $qb_no_escape[] = $this->qb_no_escape[$i]; | |
+ } | |
+ } | |
} | |
$this->$qb_variable = $qb_new; | |
+ if ($val === 'select') | |
+ { | |
+ $this->qb_no_escape = $qb_no_escape; | |
+ } | |
} | |
// If we are "protecting identifiers" we need to examine the "from" | |
@@ -2577,8 +2592,6 @@ abstract class CI_DB_query_builder extends CI_DB_driver { | |
{ | |
$this->_track_aliases($this->qb_from); | |
} | |
- | |
- $this->qb_no_escape = array_merge($this->qb_no_escape, array_diff($this->qb_cache_no_escape, $this->qb_no_escape)); | |
} | |
// -------------------------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment