Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions libraries/cms/error/page.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,32 @@ public static function render(Exception $error)
{
try
{
$app = JFactory::getApplication();
// Get the current template from the application.
// If the application is not available, fall back to the system template
$template = (is_null(JFactory::$application)) ? 'system' : JFactory::getApplication()->getTemplate();

$document = JDocument::getInstance('error');

if (!$document)
{
// We're probably in an CLI environment
exit($error->getMessage());
$app->close(0);
}

$config = JFactory::getConfig();

// Get the current template from the application
$template = $app->getTemplate();

// Push the error object into the document
$document->setError($error);

ob_end_clean();
if(ob_get_level())
{
ob_end_clean();
}

$document->setTitle(JText::_('Error') . ': ' . $error->getCode());
$data = $document->render(
false,
array('template' => $template,
'directory' => JPATH_THEMES,
'debug' => $config->get('debug'))
'debug' => JFactory::getConfig()->get('debug'))
);

// Failsafe to get the error displayed.
Expand Down
2 changes: 1 addition & 1 deletion templates/system/error.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
$this->debug = false;
}
//get language and direction
$doc = JFactory::getDocument();
$doc = JDocument::getInstance('error');
$this->language = $doc->language;
$this->direction = $doc->direction;
?>
Expand Down