function _drupal_strip_error_file_path

Strip full path information from error details.

Parameters

$error: An array with the following keys: %type, !message, %function, %file, %line and severity_level.

Return value

An array with the same keys as the $error param but with full paths stripped from the %file element

1 call to _drupal_strip_error_file_path()
_drupal_log_error in includes/errors.inc
Logs a PHP error or exception and displays an error page in fatal cases.

File

includes/errors.inc, line 306

Code

function _drupal_strip_error_file_path($error) {
    if (!empty($error['%file'])) {
        if (($drupal_root_position = strpos($error['%file'], DRUPAL_ROOT)) === 0) {
            $root_length = strlen(DRUPAL_ROOT);
            $error['%file'] = substr($error['%file'], $root_length + 1);
        }
        elseif ($drupal_root_position !== FALSE) {
            // As a fallback, make sure DRUPAL_ROOT's value is not in the path.
            $error['%file'] = str_replace(DRUPAL_ROOT, 'DRUPAL_ROOT', $error['%file']);
        }
    }
    return $error;
}

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