diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-05-25 21:28:33 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-05-25 21:28:33 -0400 |
commit | 872dc79dbd8b04424520e32675a6e0dcb6ed44bc (patch) | |
tree | 46b08d77e39c09fd415e9c943931db0a03de7c99 /app/Core/Http/Response.php | |
parent | 74a84a28e34f3c1c38631fb80cc74ab589a44298 (diff) |
Do not execute controller if the response is already sent
Diffstat (limited to 'app/Core/Http/Response.php')
-rw-r--r-- | app/Core/Http/Response.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/Core/Http/Response.php b/app/Core/Http/Response.php index 1c5310d0..0f16fb65 100644 --- a/app/Core/Http/Response.php +++ b/app/Core/Http/Response.php @@ -16,6 +16,18 @@ class Response extends Base private $httpStatusCode = 200; private $httpHeaders = array(); private $httpBody = ''; + private $responseSent = false; + + /** + * Return true if the response have been sent to the user agent + * + * @access public + * @return bool + */ + public function isResponseAlreadySent() + { + return $this->responseSent; + } /** * Set HTTP status code @@ -187,6 +199,8 @@ class Response extends Base */ public function send() { + $this->responseSent = true; + if ($this->httpStatusCode !== 200) { header('Status: '.$this->httpStatusCode); header($this->request->getServerVariable('SERVER_PROTOCOL').' '.$this->httpStatusCode); |