function drush_error_handler

8.0.x environment.inc drush_error_handler($errno, $message, $filename, $line, $context)
6.x environment.inc drush_error_handler($errno, $message, $filename, $line, $context)
7.x environment.inc drush_error_handler($errno, $message, $filename, $line, $context)
3.x environment.inc drush_error_handler($errno, $message, $filename, $line, $context)
4.x environment.inc drush_error_handler($errno, $message, $filename, $line, $context)
5.x environment.inc drush_error_handler($errno, $message, $filename, $line, $context)
master environment.inc drush_error_handler($errno, $message, $filename, $line, $context)

Log PHP errors to the Drush log. This is in effect until Drupal's error handler takes over.

1 string reference to 'drush_error_handler'
drush.php in ./drush.php
drush is a PHP script implementing a command line shell for Drupal.

File

includes/environment.inc, line 391
Functions used by drush to query the environment and setting the current configuration.

Code

function drush_error_handler($errno, $message, $filename, $line, $context) {
  // E_DEPRECATED was added in PHP 5.3. Drupal 6 will not fix all the
  // deprecated errors, but suppresses them. So we suppress them as well.
  if (defined('E_DEPRECATED')) {
    $errno = $errno & ~E_DEPRECATED;
  }

  // "error_reporting" is usually set in php.ini, but may be changed by
  // drush_errors_on() and drush_errors_off().
  if ($errno & error_reporting()) {
    // By default we log notices.
    $type = drush_get_option('php-notices', 'notice');

    // Bitmask value that constitutes an error needing to be logged.
    $error = E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR;
    if ($errno & $error) {
      $type = 'error';
    }

    // Bitmask value that constitutes a warning being logged.
    $warning = E_WARNING | E_CORE_WARNING | E_COMPILE_WARNING | E_USER_WARNING;
    if ($errno & $warning) {
      $type = 'warning';
    }

    drush_log($message . ' ' . basename($filename) . ':' . $line, $type);

    return TRUE;
  }
}