Skip to content

Commit

Permalink
Do not try to wrap output in case response handling is disabled
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Jul 28, 2016
1 parent 533ffa4 commit 2922cb7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions libraries/Response.class.php
Expand Up @@ -66,6 +66,13 @@ class PMA_Response
* @var bool
*/
private $_isAjax;
/**
* Whether response object is disabled
*
* @access private
* @var bool
*/
private $_isDisabled;
/**
* Whether we are servicing an ajax request for a page
* that was fired using the generic page handler in JS.
Expand Down Expand Up @@ -109,6 +116,7 @@ private function __construct()
$this->_isSuccess = true;
$this->_isAjax = false;
$this->_isAjaxPage = false;
$this->_isDisabled = false;
if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
$this->_isAjax = true;
}
Expand Down Expand Up @@ -181,6 +189,7 @@ public function disable()
{
$this->_header->disable();
$this->_footer->disable();
$this->_isDisabled = true;
}

/**
Expand Down Expand Up @@ -280,6 +289,12 @@ private function _htmlResponse()
*/
private function _ajaxResponse()
{
/* Avoid wrapping in case we're disabled */
if ($this->_isDisabled) {
echo $this->_getDisplay();
return;
}

if (! isset($this->_JSON['message'])) {
$this->_JSON['message'] = $this->_getDisplay();
} else if ($this->_JSON['message'] instanceof PMA_Message) {
Expand Down

0 comments on commit 2922cb7

Please sign in to comment.