Retrieve parameters from $_POST in error report

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
Maurício Meneghini Fauth 2018-08-29 22:47:17 -03:00
parent 593b2571cd
commit 737ac997f9
3 changed files with 23 additions and 23 deletions

View File

@ -13,8 +13,8 @@ use PhpMyAdmin\Utils\HttpRequest;
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 @@ $response = Response::getInstance();
$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 @@ if (isset($_REQUEST['send_error_report'])
);
}
}
$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 @@ if (isset($_REQUEST['send_error_report'])
/* 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 @@ if (isset($_REQUEST['send_error_report'])
/* 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.

View File

@ -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

View File

@ -88,10 +88,10 @@ class ErrorReport
];
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 @@ class ErrorReport
$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 = [];