Skip to content

Commit

Permalink
Register shutdown directly on singleton instance
Browse files Browse the repository at this point in the history
This avoids additional call in the shutdown handler.

Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Dec 15, 2016
1 parent f089075 commit 4e9a342
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions libraries/Response.php
Expand Up @@ -89,7 +89,7 @@ private function __construct()
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 = '';
Expand Down Expand Up @@ -419,21 +419,19 @@ private function _ajaxResponse()
/**
* 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;
Expand Down

0 comments on commit 4e9a342

Please sign in to comment.