From d53f4dd9ea0ae2e620448a5cab2f22e8ac6591bd Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Wed, 29 Jan 2014 21:35:07 -0500 Subject: [PATCH] Fixes #2139: error found while sending response is not displayed. --- framework/web/Response.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/framework/web/Response.php b/framework/web/Response.php index f84d2a0..7da1bc5 100644 --- a/framework/web/Response.php +++ b/framework/web/Response.php @@ -293,8 +293,6 @@ class Response extends \yii\base\Response { if ($this->isSent) { return; - } else { - $this->isSent = true; } $this->trigger(self::EVENT_BEFORE_SEND); $this->prepare(); @@ -302,6 +300,7 @@ class Response extends \yii\base\Response $this->sendHeaders(); $this->sendContent(); $this->trigger(self::EVENT_AFTER_SEND); + $this->isSent = true; } /** @@ -875,7 +874,7 @@ class Response extends \yii\base\Response if (method_exists($this->content, '__toString')) { $this->content = $this->content->__toString(); } else { - throw new InvalidParamException("Response content can only be an object when it implements __toString() method."); + throw new InvalidParamException("Response content must be a string or an object implementing __toString()."); } } }