Skip to content

Commit 70c197b

Browse files
author
Yajie Zhu
committed
Merge pull request #1 from snowair/snowair-patch-1
bugfix: header has sent error
2 parents 07801c3 + 93cfeb4 commit 70c197b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/PhpConsole/Storage/Session.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class Session extends AllKeysList {
2121
* @param bool $autoStart Start session if it's not started
2222
*/
2323
public function __construct($sessionKey = '__PHP_Console_postponed', $autoStart = true) {
24-
if($autoStart && (defined('PHP_SESSION_ACTIVE') ? session_status() != PHP_SESSION_ACTIVE : !session_id())) {
25-
session_start();
24+
if($autoStart && (defined('PHP_SESSION_ACTIVE') ? session_status() != PHP_SESSION_ACTIVE : !session_id()) && !headers_sent()) {
25+
session_start();
2626
}
2727
register_shutdown_function('session_write_close'); // force saving session data if session handler is overridden
2828
$this->sessionKey = $sessionKey;

0 commit comments

Comments
 (0)