From ffc3e1bcef23a382292dfa2b071b47f390f5e91f Mon Sep 17 00:00:00 2001 From: Stefan Gabos Date: Fri, 13 Feb 2015 10:57:41 +0200 Subject: [PATCH] More fixes for warning when no queries are run --- Zebra_Database.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Zebra_Database.php b/Zebra_Database.php index 5aee159..0868740 100644 --- a/Zebra_Database.php +++ b/Zebra_Database.php @@ -539,7 +539,7 @@ function __construct() $this->cached_results = $this->debug_info = $this->debugger_ip = array(); - $this->connection = $this->memcache = $this->memcache_host = $this->memcache_port = $this->memcache_compressed = $this->last_result = false; + $this->connection = $this->memcache = $this->memcache_host = $this->memcache_port = $this->memcache_compressed = false; // set default warnings: $this->warnings = array( @@ -2288,7 +2288,7 @@ function query($sql, $replacements = '', $cache = false, $calc_rows = false, $hi // add the 'SQL_CALC_FOUND_ROWS' parameter to the query $sql = preg_replace('/SELECT/i', 'SELECT SQL_CALC_FOUND_ROWS', $sql, 1); - unset($this->last_result); + if (isset($this->last_result)) unset($this->last_result); // starts a timer list($usec, $sec) = explode(' ', microtime()); @@ -4418,7 +4418,7 @@ function __destruct() { // if the last result is a mysqli result set (it can also be a boolean or not set) - if ($this->last_result instanceof mysqli_result) + if (isset($this->last_result) && $this->last_result instanceof mysqli_result) // frees the memory associated with the last result mysqli_free_result($this->last_result);