Skip to content

Commit

Permalink
Prevent calling end on stdClass, fixes ThingEngineer#1001
Browse files Browse the repository at this point in the history
  • Loading branch information
RivenSkaye committed Jul 24, 2023
1 parent 3f6f76f commit d181606
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion MysqliDb.php
Expand Up @@ -1689,7 +1689,12 @@ protected function _dynamicBindResults(mysqli_stmt $stmt)
}
$this->count++;
if ($this->_mapKey) {
$results[$row[$this->_mapKey]] = count($row) > 2 ? $result : end($result);
if (count($row) < 3 && $this->returnType == 'object') {
$res = new ArrayIterator($result);
$res->seek($_res->count() - 1);
$results[$row[$this->_mapKey]] = $res->current();
}
else $results[$row[$this->_mapKey]] = count($row) > 2 ? $result : end($result);
} else {
array_push($results, $result);
}
Expand Down

0 comments on commit d181606

Please sign in to comment.