From c8c6eb46ec6eefe0e58aebcd44f4c69f5df4b065 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev <oleg@bsdpower.com> Date: Wed, 2 Jan 2013 14:36:14 -0500 Subject: [ticket/11305] Check for $cache being null before using it in db drivers. There is no reason why db drivers must have a cache to work. They query the database, that part works without caches. PHPBB3-11305 --- phpBB/includes/db/driver/mysqli.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'phpBB/includes/db/driver/mysqli.php') diff --git a/phpBB/includes/db/driver/mysqli.php b/phpBB/includes/db/driver/mysqli.php index 4f45c5781c..7448bf1670 100644 --- a/phpBB/includes/db/driver/mysqli.php +++ b/phpBB/includes/db/driver/mysqli.php @@ -184,7 +184,7 @@ class phpbb_db_driver_mysqli extends phpbb_db_driver $this->sql_report('start', $query); } - $this->query_result = ($cache_ttl) ? $cache->sql_load($query) : false; + $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; $this->sql_add_num_queries($this->query_result); if ($this->query_result === false) @@ -199,7 +199,7 @@ class phpbb_db_driver_mysqli extends phpbb_db_driver $this->sql_report('stop', $query); } - if ($cache_ttl) + if ($cache && $cache_ttl) { $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); } @@ -256,7 +256,7 @@ class phpbb_db_driver_mysqli extends phpbb_db_driver $query_id = $this->query_result; } - if (!is_object($query_id) && $cache->sql_exists($query_id)) + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) { return $cache->sql_fetchrow($query_id); } @@ -283,7 +283,7 @@ class phpbb_db_driver_mysqli extends phpbb_db_driver $query_id = $this->query_result; } - if (!is_object($query_id) && $cache->sql_exists($query_id)) + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) { return $cache->sql_rowseek($rownum, $query_id); } @@ -311,7 +311,7 @@ class phpbb_db_driver_mysqli extends phpbb_db_driver $query_id = $this->query_result; } - if (!is_object($query_id) && $cache->sql_exists($query_id)) + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) { return $cache->sql_freeresult($query_id); } -- cgit v1.2.1