From 946012f9c8fcbc857e1ddba3459aca5ab618df5f Mon Sep 17 00:00:00 2001 From: Si Jie Date: Sat, 16 Mar 2019 14:12:35 +0700 Subject: [PATCH 1/2] Add check for empty input to change_collation Currently, if an empty input is provided to change_collation, the behaviour is as if no user input were made. This causes a bug in db_operations.php, where a blank form will be returned to the user instead of an error message. By checking for empty($_REQUEST['db_collation']) separately, we can catch bad user input and return the appropriate error message. Signed-off-by: Si Jie --- libraries/db_common.inc.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libraries/db_common.inc.php b/libraries/db_common.inc.php index d7a829f610..dee9ffcaf9 100644 --- a/libraries/db_common.inc.php +++ b/libraries/db_common.inc.php @@ -139,6 +139,18 @@ if (isset($_POST['submitcollation']) $response->addJSON('message', $message); exit; } +} elseif (isset($_POST['submitcollation']) + && isset($_POST['db_collation']) + && empty($_POST['db_collation']) +) { + $response = Response::getInstance(); + if ($response->isAjax()) { + $response->setRequestStatus(false); + $response->addJSON( + 'message', + Message::error(__('No collation provided.')) + ); + } } /** From 62d169258e10593387635846342659223913b3f7 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Tue, 28 May 2019 13:57:35 +0200 Subject: [PATCH 2/2] Fix #14987 - Add check for empty input to change_collation Fixes: #14987 Signed-off-by: William Desportes --- tbl_operations.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tbl_operations.php b/tbl_operations.php index 4ff5ab9d69..5ce82ee175 100644 --- a/tbl_operations.php +++ b/tbl_operations.php @@ -214,6 +214,18 @@ if (isset($_POST['submitoptions'])) { $GLOBALS['db'], $GLOBALS['table'], $_POST['tbl_collation'] ); } + + if (isset($_POST['tbl_collation']) && empty($_POST['tbl_collation'])) { + $response = Response::getInstance(); + if ($response->isAjax()) { + $response->setRequestStatus(false); + $response->addJSON( + 'message', + Message::error(__('No collation provided.')) + ); + exit; + } + } } /** * Reordering the table has been requested by the user