Skip to content

Commit

Permalink
[Debug] ensured that the Debug tools can only be registered once
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Apr 7, 2013
1 parent 946bfb2 commit e455269
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions src/Symfony/Component/Debug/Debug.php
Expand Up @@ -20,8 +20,26 @@
*/
class Debug
{
private static $enabled = false;

/**
* Enables the debug tools.
*
* This method registers an error handler and an exception handler.
*
* If the Symfony ClassLoader component is available, a special
* class loader is also registered.
*
* @param integer $errorReportingLevel The level of error reporting you wan
*/
public static function enable($errorReportingLevel = null)
{
if (static::$enabled) {
return;
}

static::$enabled = true;

error_reporting(-1);
ini_set('display_errors', 0);

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Debug/ErrorHandler.php
Expand Up @@ -47,7 +47,7 @@ class ErrorHandler
private static $logger;

/**
* Register the error handler.
* Registers the error handler.
*
* @param integer $level The level at which the conversion to Exception is done (null to use the error_reporting() value and 0 to disable)
*
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Debug/ExceptionHandler.php
Expand Up @@ -41,7 +41,7 @@ public function __construct($debug = true, $charset = 'UTF-8')
}

/**
* Register the exception handler.
* Registers the exception handler.
*
* @param Boolean $debug
*
Expand Down

0 comments on commit e455269

Please sign in to comment.