yii\base\Application::registerErrorHandler PHP Method

registerErrorHandler() protected method

Registers the errorHandler component as a PHP error handler.
protected registerErrorHandler ( array &$config )
$config array application config
    protected function registerErrorHandler(&$config)
    {
        if (YII_ENABLE_ERROR_HANDLER) {
            if (!isset($config['components']['errorHandler']['class'])) {
                echo "Error: no errorHandler component is configured.\n";
                exit(1);
            }
            $this->set('errorHandler', $config['components']['errorHandler']);
            unset($config['components']['errorHandler']);
            $this->getErrorHandler()->register();
        }
    }

Usage Example

Example #1
0
 /**
  * Registers the errorHandler component as a PHP error handler.
  */
 protected function registerErrorHandler(&$config)
 {
     if (!isset($config['components']['errorHandler']['class'])) {
         $config['components']['errorHandler']['class'] = 'yii\\web\\ErrorHandler';
     }
     parent::registerErrorHandler($config);
 }