function FinalExceptionSubscriber::simplifyFileInError
Same name in other branches
- 9 core/lib/Drupal/Core/EventSubscriber/FinalExceptionSubscriber.php \Drupal\Core\EventSubscriber\FinalExceptionSubscriber::simplifyFileInError()
- 8.9.x core/lib/Drupal/Core/EventSubscriber/FinalExceptionSubscriber.php \Drupal\Core\EventSubscriber\FinalExceptionSubscriber::simplifyFileInError()
- 10 core/lib/Drupal/Core/EventSubscriber/FinalExceptionSubscriber.php \Drupal\Core\EventSubscriber\FinalExceptionSubscriber::simplifyFileInError()
Attempts to reduce error verbosity in the error message's file path.
Attempts to reduce verbosity by removing DRUPAL_ROOT from the file path in the message. This does not happen for (false) security.
Parameters
$error: Optional error to examine for ERROR_REPORTING_DISPLAY_SOME.
Return value
array The updated $error.
1 call to FinalExceptionSubscriber::simplifyFileInError()
- FinalExceptionSubscriber::onException in core/
lib/ Drupal/ Core/ EventSubscriber/ FinalExceptionSubscriber.php - Handles exceptions for this subscriber.
1 method overrides FinalExceptionSubscriber::simplifyFileInError()
- TestDefaultExceptionSubscriber::simplifyFileInError in core/
tests/ Drupal/ Tests/ Core/ EventSubscriber/ FinalExceptionSubscriberTest.php - Attempts to reduce error verbosity in the error message's file path.
File
-
core/
lib/ Drupal/ Core/ EventSubscriber/ FinalExceptionSubscriber.php, line 217
Class
- FinalExceptionSubscriber
- Last-chance handler for exceptions: the final exception subscriber.
Namespace
Drupal\Core\EventSubscriberCode
protected function simplifyFileInError($error) {
// Attempt to reduce verbosity by removing DRUPAL_ROOT from the file path
// in the message. This does not happen for (false) security.
$root_length = strlen(DRUPAL_ROOT);
if (substr($error['%file'], 0, $root_length) == DRUPAL_ROOT) {
$error['%file'] = substr($error['%file'], $root_length + 1);
}
return $error;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.