Skip to content

Commit d181606

Browse files
committed
Prevent calling end on stdClass, fixes #1001
1 parent 3f6f76f commit d181606

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

MysqliDb.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1689,7 +1689,12 @@ protected function _dynamicBindResults(mysqli_stmt $stmt)
16891689
}
16901690
$this->count++;
16911691
if ($this->_mapKey) {
1692-
$results[$row[$this->_mapKey]] = count($row) > 2 ? $result : end($result);
1692+
if (count($row) < 3 && $this->returnType == 'object') {
1693+
$res = new ArrayIterator($result);
1694+
$res->seek($_res->count() - 1);
1695+
$results[$row[$this->_mapKey]] = $res->current();
1696+
}
1697+
else $results[$row[$this->_mapKey]] = count($row) > 2 ? $result : end($result);
16931698
} else {
16941699
array_push($results, $result);
16951700
}

0 commit comments

Comments
 (0)