Skip to content

Commit

Permalink
More fixes for warning when no queries are run
Browse files Browse the repository at this point in the history
  • Loading branch information
stefangabos committed Feb 13, 2015
1 parent e35151f commit ffc3e1b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Zebra_Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ffc3e1b

Please sign in to comment.