[ticket/17465] Throw bad request exceptions on invalid data requests

PHPBB-17465
This commit is contained in:
Marc Alexander 2025-01-28 20:50:29 +01:00
parent 0c1aeb862b
commit ac3e9f64d8
No known key found for this signature in database
GPG key ID: 50E0D2423696F995

View file

@ -165,6 +165,11 @@ class webpush
$notification_data = $this->db->sql_fetchfield('push_data');
$this->db->sql_freeresult($result);
if (!$notification_data)
{
throw new http_exception(Response::HTTP_BAD_REQUEST, 'AJAX_ERROR_TEXT');
}
return $this->get_notification_data($notification_data);
}
@ -192,6 +197,11 @@ class webpush
$notification_row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
if (!$notification_row || !isset($notification_row['push_data']) || !isset($notification_row['push_token']))
{
throw new http_exception(Response::HTTP_BAD_REQUEST, 'AJAX_ERROR_TEXT');
}
$notification_data = $notification_row['push_data'];
$push_token = $notification_row['push_token'];