Skip to content

Commit e455269

Browse files
committed
[Debug] ensured that the Debug tools can only be registered once
1 parent 946bfb2 commit e455269

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

src/Symfony/Component/Debug/Debug.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,26 @@
2020
*/
2121
class Debug
2222
{
23+
private static $enabled = false;
24+
25+
/**
26+
* Enables the debug tools.
27+
*
28+
* This method registers an error handler and an exception handler.
29+
*
30+
* If the Symfony ClassLoader component is available, a special
31+
* class loader is also registered.
32+
*
33+
* @param integer $errorReportingLevel The level of error reporting you wan
34+
*/
2335
public static function enable($errorReportingLevel = null)
2436
{
37+
if (static::$enabled) {
38+
return;
39+
}
40+
41+
static::$enabled = true;
42+
2543
error_reporting(-1);
2644
ini_set('display_errors', 0);
2745

src/Symfony/Component/Debug/ErrorHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ErrorHandler
4747
private static $logger;
4848

4949
/**
50-
* Register the error handler.
50+
* Registers the error handler.
5151
*
5252
* @param integer $level The level at which the conversion to Exception is done (null to use the error_reporting() value and 0 to disable)
5353
*

src/Symfony/Component/Debug/ExceptionHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct($debug = true, $charset = 'UTF-8')
4141
}
4242

4343
/**
44-
* Register the exception handler.
44+
* Registers the exception handler.
4545
*
4646
* @param Boolean $debug
4747
*

0 commit comments

Comments
 (0)