Commit ffb060c5 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Ignore exceptions thrown by smarty() calls in the middle of exception...


Ignore exceptions thrown by smarty() calls in the middle of exception handling. Avoids some 'exception thrown without a stack frame' errors.
Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent c599126a
......@@ -573,15 +573,23 @@ class MaharaException extends Exception {
$outputmessage = trim($this->render_exception());
if (function_exists('smarty') && !$this instanceof ConfigSanityException) {
$smarty = smarty(array(), array(), array(), array('sidebars' => false));
$smarty->assign('title', $outputtitle);
$smarty->assign('message', $outputmessage);
$smarty->display('error.tpl');
try {
$smarty = smarty(array(), array(), array(), array('sidebars' => false));
$smarty->assign('title', $outputtitle);
$smarty->assign('message', $outputmessage);
$smarty->display('error.tpl');
die();
}
catch (Exception $e) {
// If an exception is thrown in smarty(), ignore it
// and print the message out the ugly way
log_warn("Exception thrown by smarty call while handling exception");
}
}
else {
$outputtitle = htmlspecialchars($outputtitle, ENT_COMPAT, 'UTF-8');
$outputmessage = nl2br(htmlspecialchars($outputmessage, ENT_COMPAT, 'UTF-8'));
echo <<<EOF
$outputtitle = htmlspecialchars($outputtitle, ENT_COMPAT, 'UTF-8');
$outputmessage = nl2br(htmlspecialchars($outputmessage, ENT_COMPAT, 'UTF-8'));
echo <<<EOF
<html>
<head>
<title>$outputtitle</title>
......@@ -618,13 +626,12 @@ class MaharaException extends Exception {
</head>
<body>
EOF;
echo <<<EOF
echo <<<EOF
<h1>$outputtitle</h1>
<div id="message">$outputmessage</div>
</body>
</html>
EOF;
}
// end of printing stuff to the screen...
die();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment