Commit d53f4dd9 by Qiang Xue

Fixes #2139: error found while sending response is not displayed.

parent 5d6e6688
...@@ -293,8 +293,6 @@ class Response extends \yii\base\Response ...@@ -293,8 +293,6 @@ class Response extends \yii\base\Response
{ {
if ($this->isSent) { if ($this->isSent) {
return; return;
} else {
$this->isSent = true;
} }
$this->trigger(self::EVENT_BEFORE_SEND); $this->trigger(self::EVENT_BEFORE_SEND);
$this->prepare(); $this->prepare();
...@@ -302,6 +300,7 @@ class Response extends \yii\base\Response ...@@ -302,6 +300,7 @@ class Response extends \yii\base\Response
$this->sendHeaders(); $this->sendHeaders();
$this->sendContent(); $this->sendContent();
$this->trigger(self::EVENT_AFTER_SEND); $this->trigger(self::EVENT_AFTER_SEND);
$this->isSent = true;
} }
/** /**
...@@ -875,7 +874,7 @@ class Response extends \yii\base\Response ...@@ -875,7 +874,7 @@ class Response extends \yii\base\Response
if (method_exists($this->content, '__toString')) { if (method_exists($this->content, '__toString')) {
$this->content = $this->content->__toString(); $this->content = $this->content->__toString();
} else { } 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().");
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment