function drupal_error_levels

Same name in other branches
  1. 9 core/includes/errors.inc \drupal_error_levels()
  2. 8.9.x core/includes/errors.inc \drupal_error_levels()
  3. 10 core/includes/errors.inc \drupal_error_levels()
  4. 11.x core/includes/errors.inc \drupal_error_levels()

Maps PHP error constants to watchdog severity levels.

The error constants are documented at http://php.net/manual/errorfunc.constants.php

Related topics

1 call to drupal_error_levels()
_drupal_error_handler_real in includes/errors.inc
Provides custom PHP error handling.

File

includes/errors.inc, line 16

Code

function drupal_error_levels() {
    $types = array(
        E_ERROR => array(
            'Error',
            WATCHDOG_ERROR,
        ),
        E_WARNING => array(
            'Warning',
            WATCHDOG_WARNING,
        ),
        E_PARSE => array(
            'Parse error',
            WATCHDOG_ERROR,
        ),
        E_NOTICE => array(
            'Notice',
            WATCHDOG_NOTICE,
        ),
        E_CORE_ERROR => array(
            'Core error',
            WATCHDOG_ERROR,
        ),
        E_CORE_WARNING => array(
            'Core warning',
            WATCHDOG_WARNING,
        ),
        E_COMPILE_ERROR => array(
            'Compile error',
            WATCHDOG_ERROR,
        ),
        E_COMPILE_WARNING => array(
            'Compile warning',
            WATCHDOG_WARNING,
        ),
        E_USER_ERROR => array(
            'User error',
            WATCHDOG_ERROR,
        ),
        E_USER_WARNING => array(
            'User warning',
            WATCHDOG_WARNING,
        ),
        E_USER_NOTICE => array(
            'User notice',
            WATCHDOG_NOTICE,
        ),
        E_STRICT => array(
            'Strict warning',
            WATCHDOG_DEBUG,
        ),
        E_RECOVERABLE_ERROR => array(
            'Recoverable fatal error',
            WATCHDOG_ERROR,
        ),
    );
    // E_DEPRECATED and E_USER_DEPRECATED were added in PHP 5.3.0.
    if (defined('E_DEPRECATED')) {
        $types[E_DEPRECATED] = array(
            'Deprecated function',
            WATCHDOG_DEBUG,
        );
        $types[E_USER_DEPRECATED] = array(
            'User deprecated function',
            WATCHDOG_DEBUG,
        );
    }
    return $types;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.