From 39e524c2cfa53eb9268ce2c524af8a62af4d2db6 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Wed, 10 Feb 2021 11:55:55 +0100 Subject: [PATCH] Fix #16614 - Correct the dataseek offset on MySQLI extension Fixes #16614 Signed-off-by: William Desportes --- libraries/classes/Display/Results.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libraries/classes/Display/Results.php b/libraries/classes/Display/Results.php index 69146b3d05..325314a242 100644 --- a/libraries/classes/Display/Results.php +++ b/libraries/classes/Display/Results.php @@ -4336,7 +4336,10 @@ class Results ); // fetch last row of the result set - $dbi->dataSeek($dt_result, $this->properties['num_rows'] - 1); + $dbi->dataSeek( + $dt_result, + $this->properties['num_rows'] > 0 ? $this->properties['num_rows'] - 1 : 0 + ); $row = $dbi->fetchRow($dt_result); // check for non printable sorted row data @@ -4566,7 +4569,10 @@ class Results } // fetch last row of the result set - $dbi->dataSeek($dt_result, $this->properties['num_rows'] - 1); + $dbi->dataSeek( + $dt_result, + $this->properties['num_rows'] > 0 ? $this->properties['num_rows'] - 1 : 0 + ); $row = $dbi->fetchRow($dt_result); // @see DbiMysqi::fetchRow & DatabaseInterface::fetchRow