Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDhananjay Nakrani <dhananjaynakrani@gmail.com>2014-06-07 17:10:54 +0400
committerDhananjay Nakrani <dhananjaynakrani@gmail.com>2014-06-16 10:20:54 +0400
commit0b9439a246c4be55794d65bc589bb78b10ef4a5a (patch)
treebdc3384d06fc6d837121b84a325fd886dedef0cd /error_report.php
parent9a1fb901d048d72ec2ab7660de7e839e253cb3b8 (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.php26
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;