Example #1
0
 public function init()
 {
     if ($this->debug) {
         ini_set('display_errors', 1);
         error_reporting(-1);
         DebugClassLoader::enable();
         ErrorHandler::register($this->errorReportingLevel);
         if ('cli' !== php_sapi_name()) {
             ExceptionHandler::register();
         }
     } else {
         ini_set('display_errors', 0);
     }
 }
 public function testIdempotence()
 {
     DebugClassLoader::enable();
     DebugClassLoader::enable();
     $functions = spl_autoload_functions();
     foreach ($functions as $function) {
         if (is_array($function) && $function[0] instanceof DebugClassLoader) {
             $reflClass = new \ReflectionClass($function[0]);
             $reflProp = $reflClass->getProperty('classFinder');
             $reflProp->setAccessible(true);
             $this->assertNotInstanceOf('Symfony\\Component\\ClassLoader\\DebugClassLoader', $reflProp->getValue($function[0]));
             return;
         }
     }
     throw new \Exception('DebugClassLoader did not register');
 }
Example #3
0
 /**
  * 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 want
  */
 public static function enable($errorReportingLevel = null)
 {
     if (static::$enabled) {
         return;
     }
     static::$enabled = true;
     error_reporting(-1);
     ErrorHandler::register($errorReportingLevel);
     if ('cli' !== php_sapi_name()) {
         ExceptionHandler::register();
     } elseif (!ini_get('log_errors') || ini_get('error_log')) {
         ini_set('display_errors', 1);
     }
     if (class_exists('Symfony\\Component\\ClassLoader\\DebugClassLoader')) {
         DebugClassLoader::enable();
     }
 }
Example #4
0
 /**
  * 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 int     $errorReportingLevel The level of error reporting you want
  * @param bool    $displayErrors       Whether to display errors (for development) or just log them (for production)
  */
 public static function enable($errorReportingLevel = null, $displayErrors = true)
 {
     if (static::$enabled) {
         return;
     }
     static::$enabled = true;
     error_reporting(-1);
     ErrorHandler::register($errorReportingLevel, $displayErrors);
     if ('cli' !== php_sapi_name()) {
         ExceptionHandler::register();
         // CLI - display errors only if they're not already logged to STDERR
     } elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) {
         ini_set('display_errors', 1);
     }
     if (class_exists('Symfony\\Component\\ClassLoader\\DebugClassLoader')) {
         DebugClassLoader::enable();
     }
 }
 public function init()
 {
     ini_set('display_errors', 0);
     if ($this->debug) {
         error_reporting(-1);
         if (class_exists('Symfony\\Component\\ClassLoader\\DebugClassLoader')) {
             DebugClassLoader::enable();
         }
         ErrorHandler::register($this->errorReportingLevel);
         if ('cli' !== php_sapi_name()) {
             ExceptionHandler::register();
         } else {
             ini_set('display_errors', 1);
         }
     }
 }
<?php

use Symfony\Component\ClassLoader\DebugClassLoader;
use Symfony\Component\HttpKernel\Debug\ErrorHandler;
use Symfony\Component\HttpKernel\Debug\ExceptionHandler;
require_once __DIR__ . '/../vendor/autoload.php';
ini_set('display_errors', 1);
error_reporting(-1);
DebugClassLoader::enable();
ErrorHandler::register();
if ('cli' !== php_sapi_name()) {
    ExceptionHandler::register();
}
$app = (require __DIR__ . '/../src/app.php');
require __DIR__ . '/../config/dev.php';
require __DIR__ . '/../src/controllers.php';
$app->run();
Example #7
0
 /**
  * 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.
  */
 protected function enableDebug()
 {
     error_reporting(-1);
     ErrorHandler::register($this->errorReportingLevel);
     if ('cli' !== php_sapi_name()) {
         $handler = ExceptionHandler::register();
         $handler->setAppVersion($this->getVersion());
     } elseif (!ini_get('log_errors') || ini_get('error_log')) {
         ini_set('display_errors', 1);
     }
     if (class_exists('Symfony\\Component\\ClassLoader\\DebugClassLoader')) {
         DebugClassLoader::enable();
     }
 }