Skip to content
Permalink
Browse files

Retrieve parameters from $_POST in error report

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
  • Loading branch information...
mauriciofauth committed Aug 30, 2018
1 parent 593b257 commit 737ac997f9271d15f08b20893c9174a312027b74
Showing with 23 additions and 23 deletions.
  1. +16 −16 error_report.php
  2. +2 −2 js/error_report.js
  3. +5 −5 libraries/classes/ErrorReport.php
@@ -13,8 +13,8 @@
require_once 'libraries/common.inc.php';
if (!isset($_REQUEST['exception_type'])
||!in_array($_REQUEST['exception_type'], array('js', 'php'))
if (!isset($_POST['exception_type'])
||!in_array($_POST['exception_type'], array('js', 'php'))
) {
die('Oops, something went wrong!!');
}
@@ -23,11 +23,11 @@
$errorReport = new ErrorReport(new HttpRequest());
if (isset($_REQUEST['send_error_report'])
&& ($_REQUEST['send_error_report'] == true
|| $_REQUEST['send_error_report'] == '1')
if (isset($_POST['send_error_report'])
&& ($_POST['send_error_report'] == true
|| $_POST['send_error_report'] == '1')
) {
if ($_REQUEST['exception_type'] == 'php') {
if ($_POST['exception_type'] == 'php') {
/**
* Prevent infinite error submission.
* Happens in case error submissions fails.
@@ -51,7 +51,7 @@
);
}
}
$reportData = $errorReport->getData($_REQUEST['exception_type']);
$reportData = $errorReport->getData($_POST['exception_type']);
// report if and only if there were 'actual' errors.
if (count($reportData) > 0) {
$server_response = $errorReport->send($reportData);
@@ -65,8 +65,8 @@
/* Message to show to the user */
if ($success) {
if ((isset($_REQUEST['automatic'])
&& $_REQUEST['automatic'] === "true")
if ((isset($_POST['automatic'])
&& $_POST['automatic'] === "true")
|| $GLOBALS['cfg']['SendErrorReports'] == 'always'
) {
$msg = __(
@@ -98,35 +98,35 @@
/* Add message to response */
if ($response->isAjax()) {
if ($_REQUEST['exception_type'] == 'js') {
if ($_POST['exception_type'] == 'js') {
$response->addJSON('message', $msg);
} else {
$response->addJSON('_errSubmitMsg', $msg);
}
} elseif ($_REQUEST['exception_type'] == 'php') {
} elseif ($_POST['exception_type'] == 'php') {
$jsCode = 'PMA_ajaxShowMessage("<div class=\"error\">'
. $msg
. '</div>", false);';
$response->getFooter()->getScripts()->addCode($jsCode);
}
if ($_REQUEST['exception_type'] == 'php') {
if ($_POST['exception_type'] == 'php') {
// clear previous errors & save new ones.
$GLOBALS['error_handler']->savePreviousErrors();
}
/* Persist always send settings */
if (isset($_REQUEST['always_send'])
&& $_REQUEST['always_send'] === "true"
if (isset($_POST['always_send'])
&& $_POST['always_send'] === "true"
) {
$userPreferences = new UserPreferences();
$userPreferences->persistOption("SendErrorReports", "always", "ask");
}
}
} elseif (! empty($_REQUEST['get_settings'])) {
} elseif (! empty($_POST['get_settings'])) {
$response->addJSON('report_setting', $GLOBALS['cfg']['SendErrorReports']);
} else {
if ($_REQUEST['exception_type'] == 'js') {
if ($_POST['exception_type'] == 'js') {
$response->addHTML($errorReport->getForm());
} else {
// clear previous errors & save new ones.
@@ -19,7 +19,7 @@ var ErrorReport = {
exception.name = ErrorReport._extractExceptionName(exception);
}
ErrorReport._last_exception = exception;
$.get('error_report.php', {
$.post('error_report.php', {
ajax_request: true,
server: PMA_commonParams.get('server'),
get_settings: true,
@@ -107,7 +107,7 @@ var ErrorReport = {
}
});
}
}); // end $.get()
});
},
/**
* Shows the small notification that asks for user permission
@@ -88,10 +88,10 @@ public function getData($exceptionType = 'js')
];
if ($exceptionType == 'js') {
if (empty($_REQUEST['exception'])) {
if (empty($_POST['exception'])) {
return [];
}
$exception = $_REQUEST['exception'];
$exception = $_POST['exception'];
$exception["stack"] = $this->translateStacktrace($exception["stack"]);
list($uri, $scriptName) = $this->sanitizeUrl($exception["url"]);
$exception["uri"] = $uri;
@@ -100,10 +100,10 @@ public function getData($exceptionType = 'js')
$report["exception_type"] = 'js';
$report["exception"] = $exception;
$report["script_name"] = $scriptName;
$report["microhistory"] = $_REQUEST['microhistory'];
$report["microhistory"] = $_POST['microhistory'];
if (! empty($_REQUEST['description'])) {
$report['steps'] = $_REQUEST['description'];
if (! empty($_POST['description'])) {
$report['steps'] = $_POST['description'];
}
} elseif ($exceptionType == 'php') {
$errors = [];

0 comments on commit 737ac99

Please sign in to comment.
You can’t perform that action at this time.