Check decoded string for array

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2022-02-27 18:25:53 +01:00
parent 60122713a8
commit 0dd9b304ac

View File

@@ -45,9 +45,9 @@ function JSON_error($message = null)
// Delete message identified by IDs
if ($_POST['action'] == 'delete_message' && isset($_POST['id'])) {
try {
if(!is_array($_POST['id']))
throw new Exception('Invalid payload: id is not an array');
$ids = json_decode($_POST['id']);
if(!is_array($ids))
throw new Exception('Invalid payload: id is not an array');
// Explot prevention: Ensure all entries in the ID array are integers
foreach($ids as $value) {
if (!is_numeric($value))