Skip to content

Commit 44bbe3c

Browse files
committed
added Debugger::$showBar, can disable debug bar [Closes #132][Closes #83][Closes #82]
1 parent bb0f3eb commit 44bbe3c

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

src/Tracy/Debugger.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ class Debugger
2929
/** @var bool in production mode is suppressed any debugging output */
3030
public static $productionMode = self::DETECT;
3131

32+
/** @var bool whether to display debug bar in development mode */
33+
public static $showBar = TRUE;
34+
3235
/** @var bool {@link Debugger::enable()} */
3336
private static $enabled = FALSE;
3437

@@ -198,7 +201,7 @@ public static function shutdownHandler()
198201
FALSE
199202
);
200203

201-
} elseif (!connection_aborted() && !self::$productionMode && self::isHtmlMode()) {
204+
} elseif (self::$showBar && !connection_aborted() && !self::$productionMode && self::isHtmlMode()) {
202205
self::getBar()->render();
203206
}
204207
}
@@ -245,7 +248,9 @@ public static function exceptionHandler($exception, $exit = TRUE)
245248

246249
} elseif (!connection_aborted() && self::isHtmlMode()) {
247250
self::getBlueScreen()->render($exception);
248-
self::getBar()->render();
251+
if (self::$showBar) {
252+
self::getBar()->render();
253+
}
249254

250255
} else {
251256
self::fireLog($exception);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
/**
4+
* Test: Tracy\Debugger Bar disabled.
5+
* @outputMatch
6+
*/
7+
8+
use Tracy\Debugger;
9+
use Tester\Assert;
10+
11+
12+
require __DIR__ . '/../bootstrap.php';
13+
14+
if (PHP_SAPI === 'cli') {
15+
Tester\Environment::skip('Debugger Bar is not rendered in CLI mode');
16+
}
17+
18+
19+
Debugger::$productionMode = FALSE;
20+
Debugger::$showBar = FALSE;
21+
header('Content-Type: text/html');
22+
23+
Debugger::enable();

0 commit comments

Comments
 (0)