- md5
- d96512ca3b7193c330bdb68b8ee4c672
- sha1
- d5e71b2caf216ac0387a50901d107b16f1e3f2b3
- sha256
- 99154bb3cbdf4f283bec12aaa1465c98742e542d3e95b529ef12a27d1e0cdd3b
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
<?php
/**
* @package Joomla.Libraries
* @subpackage Error
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_PLATFORM') or die;
/**
* Displays the custom error page when an uncaught exception occurs.
*
* @since 3.0
*/
class JErrorPage
{
/**
* Render the error page based on an exception.
*
* @param Exception $error The exception for which to render the error page.
*
* @return void
*
* @since 3.0
*/
public static function render(Exception $error)
{
try
{
$app = JFactory::getApplication();
$document = JDocument::getInstance('error');
if (!$document)
{
// We're probably in an CLI environment
jexit($error->getMessage());
}
// Get the current template from the application
$template = $app->getTemplate();
// Push the error object into the document
$document->setError($error);
if (ob_get_contents())
{
ob_end_clean();
}
$document->setTitle(JText::_('Error') . ': ' . $error->getCode());
$data = $document->render(
false,
array(
'template' => $template,
'directory' => JPATH_THEMES,
'debug' => JDEBUG
)
);
// Do not allow cache
$app->allowCache(false);
// If nothing was rendered, just use the message from the Exception
if (empty($data))
{
$data = $error->getMessage();
}
$app->setBody($data);
echo $app->toString();
}
catch (Exception $e)
{
// Try to set a 500 header if they haven't already been sent
if (!headers_sent())
{
header('HTTP/1.1 500 Internal Server Error');
}
jexit('Error displaying the error page: ' . $e->getMessage() . ': ' . $error->getMessage());
}
}
}
The same content is in 11 releases, Joomla 3.4.2-rc to 3.4.8. See them all, or every version of this file.