Skip to content

Commit 07801cb

Browse files
committed
set not removable output bufferization(to prevent headers sending)
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.
1 parent 689ddce commit 07801cb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/PhpConsole/Connector.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ private final function initConnection() {
9292
}
9393

9494
$this->initServerCookie();
95-
9695
$this->client = $this->initClient();
96+
9797
if($this->client) {
98-
ob_start(); // required to prevent untimely headers sending
98+
ob_start(null, null, defined('PHP_OUTPUT_HANDLER_FLUSHABLE') ? PHP_OUTPUT_HANDLER_FLUSHABLE : false); // required to prevent untimely headers sending
9999
$this->isActiveClient = true;
100100
$this->registerFlushOnShutDown();
101101
$this->setHeadersLimit(isset($_SERVER['SERVER_SOFTWARE']) && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false
102-
? 4096 // headers limit for Nginx
103-
: 8192 // headers limit for all other web-servers
102+
? 4096 // default headers limit for Nginx
103+
: 8192 // default headers limit for all other web-servers
104104
);
105105

106106
$this->listenGetPostponedResponse();

0 commit comments

Comments
 (0)