diff --git a/framework/yii/base/Application.php b/framework/yii/base/Application.php index 0381e16..0b14a8c 100644 --- a/framework/yii/base/Application.php +++ b/framework/yii/base/Application.php @@ -475,6 +475,8 @@ abstract class Application extends Module */ public function handleFatalError() { + unset($this->_memoryReserve); + // load ErrorException manually here because autoloading them will not work // when error occurs while autoloading a class if (!class_exists('\\yii\\base\\Exception', false)) { @@ -487,7 +489,6 @@ abstract class Application extends Module $error = error_get_last(); if (ErrorException::isFatalError($error)) { - unset($this->_memoryReserve); $exception = new ErrorException($error['message'], $error['type'], $error['type'], $error['file'], $error['line']); // use error_log because it's too late to use Yii log error_log($exception); diff --git a/framework/yii/base/ErrorHandler.php b/framework/yii/base/ErrorHandler.php index 39c87b0..99428fc 100644 --- a/framework/yii/base/ErrorHandler.php +++ b/framework/yii/base/ErrorHandler.php @@ -192,11 +192,16 @@ class ErrorHandler extends Component */ public function renderFile($_file_, $_params_) { - ob_start(); - ob_implicit_flush(false); - extract($_params_, EXTR_OVERWRITE); - require(Yii::getAlias($_file_)); - return ob_get_clean(); + $_params_['handler'] = $this; + if ($this->exception instanceof ErrorException) { + ob_start(); + ob_implicit_flush(false); + extract($_params_, EXTR_OVERWRITE); + require(Yii::getAlias($_file_)); + return ob_get_clean(); + } else { + return Yii::$app->getView()->renderFile($_file_, $_params_, $this); + } } /** diff --git a/framework/yii/views/errorHandler/callStackItem.php b/framework/yii/views/errorHandler/callStackItem.php index 2cbced0..20ad398 100644 --- a/framework/yii/views/errorHandler/callStackItem.php +++ b/framework/yii/views/errorHandler/callStackItem.php @@ -8,19 +8,19 @@ * @var string[] $lines * @var integer $begin * @var integer $end - * @var \yii\base\ErrorHandler $this + * @var \yii\base\ErrorHandler $handler */ ?> -
htmlEncode($lines[$i]); + echo (trim($lines[$i]) == '') ? " \n" : $handler->htmlEncode($lines[$i]); } ?>
- The above error occurred while the Web server was processing your request. -
-- Please contact us if you think this is a server error. Thank you. -
-+ The above error occurred while the Web server was processing your request. +
++ Please contact us if you think this is a server error. Thank you. +
+