diff --git a/error_report.php b/error_report.php
index 4a4705cfc1..a0566d5609 100644
--- a/error_report.php
+++ b/error_report.php
@@ -13,28 +13,66 @@ $response = PMA_Response::getInstance();
if (isset($_REQUEST['send_error_report'])
&& $_REQUEST['send_error_report'] == true
) {
- PMA_sendErrorReport(PMA_getReportData(false));
+ $server_response = PMA_sendErrorReport(PMA_getReportData(false));
+ $success = $server_response === false ? false : json_decode($server_response, true)["success"];
if ($_REQUEST['automatic'] === "true") {
- $response->addJSON(
- 'message',
- PMA_Message::error(
- __(
- 'An error has been detected and an error report has been '
- .'automatically submitted based on your settings.'
+ if ($success) {
+ $response->addJSON(
+ 'message',
+ PMA_Message::error(
+ __(
+ 'An error has been detected and an error report has been '
+ .'automatically submitted based on your settings.'
+ )
+ . '
'
+ . __('You may want to refresh the page.')
)
- . '
'
- . __('You may want to refresh the page.')
- )
- );
+ );
+ } else {
+ $response->addJSON(
+ 'message',
+ PMA_Message::error(
+ __(
+ 'An error has been detected and an error report has been '
+ .'generated but failed to be sent.'
+ )
+ . ' '
+ . __(
+ 'If you experience any '
+ .'problems please submit a bug report manually'
+ )
+ . '
'
+ . __('You may want to refresh the page.')
+ )
+ );
+ }
} else {
- $response->addJSON(
- 'message',
- PMA_Message::success(
- __('Thank you for submitting this report.')
- . '
'
- . __('You may want to refresh the page.')
- )
- );
+ if ($success) {
+ $response->addJSON(
+ 'message',
+ PMA_Message::success(
+ __('Thank you for submitting this report.')
+ . '
'
+ . __('You may want to refresh the page.')
+ )
+ );
+ } else {
+ $response->addJSON(
+ 'message',
+ PMA_Message::error(
+ __('Thank you for submitting this report.')
+ . ' '
+ . __('Unfortunately the submission failed.')
+ . ' '
+ . __(
+ 'If you experience any '
+ .'problems please submit a bug report manually'
+ )
+ . '
'
+ . __('You may want to refresh the page.')
+ )
+ );
+ }
if ($_REQUEST['always_send'] === "true") {
PMA_persistOption("SendErrorReports", "always", "ask");
}