From 5f61f0fb9fb27e0e90876605afbbaf14942ec44e Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Tue, 4 Aug 2020 09:16:49 +0100 Subject: [PATCH] Issue #3151095 by dww, alexpott, jungle: Replace use of whitelist/blacklist in \Drupal\Core\Utility\Error and its test --- core/lib/Drupal/Core/Utility/Error.php | 8 ++++---- core/tests/Drupal/Tests/Core/Utility/ErrorTest.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/lib/Drupal/Core/Utility/Error.php b/core/lib/Drupal/Core/Utility/Error.php index d8c477655f6c..092f7626e210 100644 --- a/core/lib/Drupal/Core/Utility/Error.php +++ b/core/lib/Drupal/Core/Utility/Error.php @@ -19,11 +19,11 @@ class Error { const ERROR = 3; /** - * An array of blacklisted functions. + * An array of ignored functions. * * @var array */ - protected static $blacklistFunctions = ['debug', '_drupal_error_handler', '_drupal_exception_handler']; + protected static $ignoredFunctions = ['debug', '_drupal_error_handler', '_drupal_exception_handler']; /** * Decodes an exception and retrieves the correct caller. @@ -110,9 +110,9 @@ public static function renderExceptionSafe($exception) { */ public static function getLastCaller(array &$backtrace) { // Errors that occur inside PHP internal functions do not generate - // information about file and line. Ignore black listed functions. + // information about file and line. Ignore the ignored functions. while (($backtrace && !isset($backtrace[0]['line'])) || - (isset($backtrace[1]['function']) && in_array($backtrace[1]['function'], static::$blacklistFunctions))) { + (isset($backtrace[1]['function']) && in_array($backtrace[1]['function'], static::$ignoredFunctions))) { array_shift($backtrace); } diff --git a/core/tests/Drupal/Tests/Core/Utility/ErrorTest.php b/core/tests/Drupal/Tests/Core/Utility/ErrorTest.php index e89f21d103f0..aac9812ed53c 100644 --- a/core/tests/Drupal/Tests/Core/Utility/ErrorTest.php +++ b/core/tests/Drupal/Tests/Core/Utility/ErrorTest.php @@ -49,7 +49,7 @@ public function providerTestGetLastCaller() { $two_items[] = $this->createBacktraceItem('test_function_two', 'TestClass'); $data[] = [$two_items, $this->createBacktraceItem('TestClass->test_function_two()')]; - // Add blacklist functions to backtrace. They should get removed. + // Add ignored functions to backtrace. They should get removed. foreach (['debug', '_drupal_error_handler', '_drupal_exception_handler'] as $function) { $two_items = $single_item; // Push to the start of the backtrace. -- GitLab