public static function setupErrorHandler() { // note these are only valid for the default php error handler if (self::$devmode) { // Show all errors, warnings and notices including coding standards (see php.ini). self::$errMask = E_ALL | E_STRICT | E_DEPRECATED; error_reporting(self::$errMask); } else { self::$errMask = E_ALL & ~E_NOTICE & ~E_USER_WARNING & ~E_USER_NOTICE; error_reporting(self::$errMask); } set_error_handler('coreError::errorHandler'); }
/** * Initializes and setup configuration for the application * * @param string $rootDir Project root directory * @param string $application Application name * @param boolean $debug True for debug mode, false for production */ public function __construct($rootDir = null, $application, $debug) { $this->rootDir = is_null($rootDir) ? self::guessRootDir() : realpath($rootDir); $this->coreLibDir = realpath(dirname(__FILE__)); // class autoloading coreAutoload::register(); ini_set('magic_quotes_runtime', 'off'); ini_set('register_globals', 'off'); $this->setRootDir($this->rootDir); // setup application directories coreConfig::set('debug', (bool) $debug); $this->setAppDir(coreConfig::get('apps_dir') . DIRECTORY_SEPARATOR . $application); // set default constants required by Symfony libraries $this->setSymfonyConfig($debug); require_once $this->coreLibDir . '/coreError.php'; coreError::initialize($debug); // handy functions for debugging output and raising user errors require_once $this->coreLibDir . '/coreDebug.php'; }