diff options
author | Dhananjay Nakrani <dhananjaynakrani@gmail.com> | 2014-06-07 17:10:54 +0400 |
---|---|---|
committer | Dhananjay Nakrani <dhananjaynakrani@gmail.com> | 2014-06-16 10:20:54 +0400 |
commit | 0b9439a246c4be55794d65bc589bb78b10ef4a5a (patch) | |
tree | bdc3384d06fc6d837121b84a325fd886dedef0cd /error_report.php | |
parent | 9a1fb901d048d72ec2ab7660de7e839e253cb3b8 (diff) |
Make automatic php error report submission ('sendErrorReport'='always') aysnchronous. Stop infinite auto error reporting loop.
Signed-off-by: Dhananjay Nakrani <dhananjaynakrani@gmail.com>
Diffstat (limited to 'error_report.php')
-rw-r--r-- | error_report.php | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/error_report.php b/error_report.php index 6a3b672517..00f443cbf1 100644 --- a/error_report.php +++ b/error_report.php @@ -79,8 +79,32 @@ if (isset($_REQUEST['exception_type']) if (isset($_REQUEST['send_error_report']) && $_REQUEST['send_error_report'] == '1' ) { + /** + * Prevent inifnite error submission. + * Happens in case error submissions fails. + * If reporting is done in some time interval, just clear them & clear json data too. + */ + if (isset($_SESSION['prev_error_subm_time']) + && isset($_SESSION['error_subm_count']) + && $_SESSION['error_subm_count'] >= 3 // allow maximum 4 attempts + && ($_SESSION['prev_error_subm_time']-time()) <= 3000 // in 3 seconds + ) { + $_SESSION['error_subm_count'] = 0; + $_SESSION['prev_errors'] = ''; + $response = PMA_Response::getInstance(); + $response->addJSON('_stopErrorReportLoop', '1'); + } else { + $_SESSION['prev_error_subm_time'] = time(); + $_SESSION['error_subm_count'] = ( + (isset($_SESSION['error_subm_count'])) + ? ($_SESSION['error_subm_count']+1) + : (0) + ); + } + $reportData = PMA_getReportData('php'); - if ($reportData) { + // report if and only if there were 'actual' errors. + if($reportData) { $server_response = PMA_sendErrorReport($reportData); if ($server_response === false) { $success = false; |