Skip to content

Commit

Permalink
set not removable output bufferization(to prevent headers sending)
Browse files Browse the repository at this point in the history
Some "smart" frameworks are using `flush()` and `while(ob_get_level()) ob_end_flush();` calls to force output flushing, so headers are sent before script shutdown, so php-console can't send own headers.
  • Loading branch information
barbushin committed Dec 24, 2013
1 parent 689ddce commit 07801cb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/PhpConsole/Connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ private final function initConnection() {
}

$this->initServerCookie();

$this->client = $this->initClient();

if($this->client) {
ob_start(); // required to prevent untimely headers sending
ob_start(null, null, defined('PHP_OUTPUT_HANDLER_FLUSHABLE') ? PHP_OUTPUT_HANDLER_FLUSHABLE : false); // required to prevent untimely headers sending
$this->isActiveClient = true;
$this->registerFlushOnShutDown();
$this->setHeadersLimit(isset($_SERVER['SERVER_SOFTWARE']) && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false
? 4096 // headers limit for Nginx
: 8192 // headers limit for all other web-servers
? 4096 // default headers limit for Nginx
: 8192 // default headers limit for all other web-servers
);

$this->listenGetPostponedResponse();
Expand Down

0 comments on commit 07801cb

Please sign in to comment.