Fix #14239 Line and some other charts ignore result set order of values chosen for the x-axis

Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
This commit is contained in:
Madhura Jayaratne 2018-05-06 08:59:06 +10:00
parent 0d2f70c875
commit 7b27484897
2 changed files with 19 additions and 6 deletions

View File

@ -10,6 +10,7 @@ phpMyAdmin - ChangeLog
- issue #14246 Fixed error in configuration storage zero config
- issue #14128 Show 2FA Secret next to QR code
- issue #14212 XML Export from single table throws fatal error
- issue #14239 Line and some other charts ignore result set order of values chosen for the x-axis
4.8.0.1 (2018-04-19)
- issue [security] Multiple CSRF vulnerabilities, See PMASA-2018-02

View File

@ -10,6 +10,8 @@ namespace PhpMyAdmin\Controllers\Table;
use PhpMyAdmin\Controllers\TableController;
use PhpMyAdmin\Message;
use PhpMyAdmin\Response;
use PhpMyAdmin\SqlParser\Components\Limit;
use PhpMyAdmin\SqlParser\Parser;
use PhpMyAdmin\Table;
use PhpMyAdmin\Template;
use PhpMyAdmin\Util;
@ -199,12 +201,22 @@ class TableChartController extends TableController
include './libraries/tbl_common.inc.php';
}
$sql_with_limit = sprintf(
'SELECT * FROM(%s) AS `temp_res` LIMIT %s, %s',
$this->sql_query,
$_REQUEST['pos'],
$_REQUEST['session_max_rows']
);
$parser = new Parser($this->sql_query);
$statement = $parser->statements[0];
if (empty($statement->limit)) {
$statement->limit = new Limit(
$_REQUEST['session_max_rows'], $_REQUEST['pos']
);
} else {
$start = $statement->limit->offset + $_REQUEST['pos'];
$rows = min(
$_REQUEST['session_max_rows'],
$statement->limit->rowCount - $_REQUEST['pos']
);
$statement->limit = new Limit($rows, $start);
}
$sql_with_limit = $statement->build();
$data = array();
$result = $this->dbi->tryQuery($sql_with_limit);
while ($row = $this->dbi->fetchAssoc($result)) {