Skip to content

Commit 9c44600

Browse files
committed
Suppress warnings while connecting to PHP Console to avoid headers already sent warning
1 parent d2576cf commit 9c44600

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
### 1.5.4 (28 May 2019)
4+
* Fix: Temporarily suppress PHP warnings while connecting with PHP Console to avoid headers already sent warnings, then restore all errors reporting
5+
36
### 1.5.3 (22 May 2019)
47
* Fix: Try to get rid of PHP errors related to "Unable to set PHP Console server cookie" and "Cannot modify header information - headers already sent"
58
* Misc: Require PHP 5.6

includes/class-wp-php-console.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Plugin {
1515

1616

1717
/** @var string plugin version */
18-
CONST VERSION = '1.5.3';
18+
CONST VERSION = '1.5.4';
1919

2020
/** @var string plugin name */
2121
CONST NAME = 'WP PHP Console';
@@ -107,7 +107,10 @@ private function set_admin() {
107107
*/
108108
public function connect() {
109109

110-
if ( ! @session_id() ) {
110+
// workaround for avoiding headers already sent warnings
111+
@error_reporting( E_ALL & ~E_WARNING );
112+
113+
if ( empty( @session_id() ) ) {
111114
@session_start();
112115
}
113116

@@ -119,6 +122,9 @@ public function connect() {
119122
}
120123
}
121124

125+
// restore error reporting
126+
@error_reporting( E_ALL );
127+
122128
// apply PHP Console options
123129
$this->apply_options();
124130
}

readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Tags: dev, development, bug, debug, debugging, stacktrace, php, console, termina
55
Requires at least: 3.6.0
66
Requires PHP: 5.6
77
Tested up to: 5.2.1
8-
Stable tag: 1.5.3
8+
Stable tag: 1.5.4
99
License: GPLv2 or later
1010
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1111

@@ -128,6 +128,9 @@ None.
128128

129129
== Changelog ==
130130

131+
= 1.5.4 =
132+
* Fix: Temporarily suppress PHP warnings while connecting with PhpConsole to avoid headers already sent warnings, then restore all errors reporting
133+
131134
= 1.5.3 =
132135
* Fix: Try to get rid of PHP errors related to "Unable to set PHP Console server cookie" and "Cannot modify header information - headers already sent"
133136
* Misc: Require PHP 5.6

wp-php-console.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Plugin URI: https://github.com/unfulvio/wp-php-console/
55
* Description: An implementation of PHP Console for WordPress. Easily debug and trace PHP errors and warnings from your Chrome dev tools console using a Google Chrome extension.
66
*
7-
* Version: 1.5.3
7+
* Version: 1.5.4
88
*
99
* Author: Fulvio Notarstefano
1010
* Author URI: https://github.com/unfulvio/
@@ -19,8 +19,8 @@
1919
* Copyright (c) 2014-2019 Fulvio Notarstefano <[email protected]>
2020
* and contributors https://github.com/unfulvio/wp-php-console/graphs/contributors
2121
*
22-
* PhpConsole server library
23-
* Copyright (c) 2011-2016 by Barbushin Sergey <[email protected]>
22+
* PHP Console server library
23+
* Copyright (c) 2011-2019 by Barbushin Sergey <[email protected]>
2424
*
2525
* This program is free software; you can redistribute it and/or modify
2626
* it under the terms of the GNU General Public License, version 2 or, at

0 commit comments

Comments
 (0)