Browse Source

safer exception rendering

tags/2.0.0-beta
Alexander Makarov 12 years ago
parent
commit
2a12fdbcdf
  1. 5
      framework/base/ErrorHandler.php

5
framework/base/ErrorHandler.php

@ -81,6 +81,7 @@ class ErrorHandler extends Component
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest') { if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest') {
\Yii::$app->renderException($exception); \Yii::$app->renderException($exception);
} else { } else {
try {
$view = new View; $view = new View;
if (!YII_DEBUG || $exception instanceof UserException) { if (!YII_DEBUG || $exception instanceof UserException) {
$viewName = $this->errorView; $viewName = $this->errorView;
@ -91,6 +92,10 @@ class ErrorHandler extends Component
'exception' => $exception, 'exception' => $exception,
), $this); ), $this);
} }
catch (\Exception $e) {
\Yii::$app->renderException($e);
}
}
} else { } else {
\Yii::$app->renderException($exception); \Yii::$app->renderException($exception);
} }

Loading…
Cancel
Save