Browse files

[Debug] ensured that the Debug tools can only be registered once

  • Loading branch information...
1 parent 946bfb2 commit e455269ba384eab6fcdbf4a74f27da87d7a4a190 @fabpot fabpot committed Mar 21, 2013
View
18 src/Symfony/Component/Debug/Debug.php
@@ -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);
View
2 src/Symfony/Component/Debug/ErrorHandler.php
@@ -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)
*
View
2 src/Symfony/Component/Debug/ExceptionHandler.php
@@ -41,7 +41,7 @@ public function __construct($debug = true, $charset = 'UTF-8')
}
/**
- * Register the exception handler.
+ * Registers the exception handler.
*
* @param Boolean $debug
*

0 comments on commit e455269

Please sign in to comment.