Permalink
Browse files

Fixed bug when the first argument for `fetch_assoc_all` and `fetch_ob…

…j_all` was a resource
  • Loading branch information...
stefangabos committed Dec 7, 2018
1 parent 37ef81c commit 6cb2b2caeb1bcfbdfaa4b1f7ad3d9e703bfc40f2
Showing with 16 additions and 4 deletions.
  1. +16 −4 Zebra_Database.php
@@ -1385,10 +1385,16 @@ public function fetch_assoc_all($index = '', $resource = '') {
// if no active connection exists, return false
if (!$this->_connected()) return false;
// if $resource is still an empty string, it means the first argument was skipped
if ($resource == '') {
// if only one argument was given
// meaning that the first argument is either a valid resource or a pointer to an array taken from cache
if ($resource == '' && $this->_is_result($index) || (is_integer($index) && isset($this->cached_results[$index]))) {
// use the first argument as the actual resource
$resource = $index;
// consider first argument as skipped
$index = '';
}
// if no resource was specified, and a query was run before, assign the last resource
@@ -1547,10 +1553,16 @@ public function fetch_obj_all($index = '', $resource = '') {
// if no active connection exists, return false
if (!$this->_connected()) return false;
// if $resource is still an empty string, it means the first argument was skipped
if ($resource == '') {
// if only one argument was given
// meaning that the first argument is either a valid resource or a pointer to an array taken from cache
if ($resource == '' && $this->_is_result($index) || (is_integer($index) && isset($this->cached_results[$index]))) {
// use the first argument as the actual resource
$resource = $index;
// consider first argument as skipped
$index = '';
}
// if no resource was specified, and a query was run before, assign the last resource

0 comments on commit 6cb2b2c

Please sign in to comment.