From 8adac96fdc90cfc8c667d64b95ae29845808947b Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 28 Oct 2013 14:13:09 +0200 Subject: Fix CI_DB_query_builder::_merge_cache() triggering E_WARNINGs Kudos to kakysha for noting the bug & providing initial fix in PR #2698 --- system/database/DB_query_builder.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'system') diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index a36501eb6..95c3af3a9 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -2551,11 +2551,13 @@ abstract class CI_DB_query_builder extends CI_DB_driver { $qb_variable = 'qb_'.$val; $qb_cache_var = 'qb_cache_'.$val; - if (count($this->$qb_cache_var) === 0) + if (count($this->$qb_cache_var) > 0) { - continue; + foreach ($this->$qb_cache_var as &$cache_var) + { + in_array($cache_var, $this->$qb_variable, TRUE) OR $this->$qb_variable[] = $cache_var; + } } - $this->$qb_variable = array_merge($this->$qb_variable, array_diff($this->$qb_cache_var, $this->$qb_variable)); } // If we are "protecting identifiers" we need to examine the "from" -- cgit v1.2.3-24-g4f1b