Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent an infinite loop in sendErrorPage() #14108

Merged
merged 3 commits into from Oct 15, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions core/model/modx/modx.class.php
Expand Up @@ -1114,8 +1114,9 @@ public function sendRedirect($url, $options= false, $type= '', $responseCode = '
*
* @param integer $id The resource identifier.
* @param string $options An array of options for the process.
* @param boolean $sendErrorPage Whether we should skip the sendErrorPage if the resource does not exist.
*/
public function sendForward($id, $options = null) {
public function sendForward($id, $options = null, $sendErrorPage = true) {
if (!$this->getRequest()) {
$this->log(modX::LOG_LEVEL_FATAL, "Could not load request class.");
}
Expand Down Expand Up @@ -1167,7 +1168,7 @@ public function sendForward($id, $options = null) {
}
$this->request->prepareResponse();
exit();
} else {
} elseif ($sendErrorPage) {
$this->sendErrorPage();
}
$options= array_merge(
Expand Down Expand Up @@ -1204,7 +1205,7 @@ public function sendErrorPage($options = null) {
$options
);
$this->invokeEvent('OnPageNotFound', $options);
$this->sendForward($this->getOption('error_page', $options, $this->getOption('site_start')), $options);
$this->sendForward($this->getOption('error_page', $options, $this->getOption('site_start')), $options, false);
}

/**
Expand Down