From 4e9a34279490c2efc810c165b075e32c70c6fb2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 15 Dec 2016 09:04:50 +0100 Subject: [PATCH] Register shutdown directly on singleton instance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This avoids additional call in the shutdown handler. Signed-off-by: Michal Čihař --- libraries/Response.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/libraries/Response.php b/libraries/Response.php index b67df80ec8..02cc5e48da 100644 --- a/libraries/Response.php +++ b/libraries/Response.php @@ -89,7 +89,7 @@ class Response if (! defined('TESTSUITE')) { $buffer = OutputBuffering::getInstance(); $buffer->start(); - register_shutdown_function(array('PMA\libraries\Response', 'response')); + register_shutdown_function(array($this, 'response')); } $this->_header = new Header(); $this->_HTML = ''; @@ -419,21 +419,19 @@ class Response /** * Sends an HTML response to the browser * - * @static * @return void */ - public static function response() + public function response() { - $response = Response::getInstance(); - chdir($response->getCWD()); + chdir($this->getCWD()); $buffer = OutputBuffering::getInstance(); - if (empty($response->_HTML)) { - $response->_HTML = $buffer->getContents(); + if (empty($this->_HTML)) { + $this->_HTML = $buffer->getContents(); } - if ($response->isAjax()) { - $response->_ajaxResponse(); + if ($this->isAjax()) { + $this->_ajaxResponse(); } else { - $response->_htmlResponse(); + $this->_htmlResponse(); } $buffer->flush(); exit;