Skip to content

Commit 807b528

Browse files
committed
Add session_id check
1 parent f36abbc commit 807b528

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

includes/class-wp-php-console.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,20 @@ private function set_admin() {
126126
}
127127

128128
}
129-
130-
129+
130+
131131
/**
132132
* Connect to PHP Console.
133133
*
134134
* @since 1.4.0
135135
*/
136136
public function connect() {
137137

138-
session_start();
138+
// PhpConsole needs to hook in session, in WordPress we need to be in 'init'
139+
// @link http://silvermapleweb.com/using-the-php-session-in-wordpress/
140+
if ( ! session_id() ) {
141+
session_start();
142+
}
139143

140144
if ( ! $this->connector instanceof PhpConsole\Connector ) {
141145
$this->connector = PhpConsole\Connector::getInstance();

0 commit comments

Comments
 (0)