commit bdc64a04f51cc1a9a0da2580e9a3aa08581c49ea Author: Joel Pittet Date: Fri Aug 14 11:36:05 2015 -0500 remove safemarkup::xssFilter diff --git a/core/includes/errors.inc b/core/includes/errors.inc index 5735dbf..e80a56d 100644 --- a/core/includes/errors.inc +++ b/core/includes/errors.inc @@ -8,6 +8,7 @@ use Drupal\Component\Utility\SafeMarkup; use Drupal\Component\Utility\Xss; use Drupal\Core\Logger\RfcLogLevel; +use Drupal\Core\Render\SafeString; use Drupal\Core\Utility\Error; use Symfony\Component\HttpFoundation\Response; @@ -68,7 +69,7 @@ function _drupal_error_handler_real($error_level, $message, $filename, $line, $c '%type' => isset($types[$error_level]) ? $severity_msg : 'Unknown error', // The standard PHP error handler considers that the error messages // are HTML. We mimick this behavior here. - '@message' => SafeMarkup::xssFilter($message, Xss::getAdminTagList()), + '@message' => SafeString::create(Xss::filterAdmin($message)), '%function' => $caller['function'], '%file' => $caller['file'], '%line' => $caller['line'], @@ -261,7 +262,7 @@ function _drupal_log_error($error, $fatal = FALSE) { if ($message) { if (\Drupal::hasService('session')) { // Message display is dependent on sessions being available. - drupal_set_message(SafeMarkup::set($message), $class, TRUE); + drupal_set_message(SafeString::create($message), $class, TRUE); } else { print $message; diff --git a/core/includes/update.inc b/core/includes/update.inc index d69a10c..8e9a24c 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -188,9 +188,6 @@ function update_do_one($module, $number, $dependency_map, &$context) { $variables = Error::decodeException($e); unset($variables['backtrace']); - // The exception message is run through - // \Drupal\Component\Utility\SafeMarkup::checkPlain() by - // \Drupal\Core\Utility\Error::decodeException(). $ret['#abort'] = array('success' => FALSE, 'query' => t('%type: @message in %function (line %line of %file).', $variables)); } } diff --git a/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php index 4ca657f..fd1348e 100644 --- a/core/modules/simpletest/src/TestBase.php +++ b/core/modules/simpletest/src/TestBase.php @@ -1391,8 +1391,6 @@ protected function exceptionHandler($exception) { 'line' => $exception->getLine(), 'file' => $exception->getFile(), )); - // \Drupal\Core\Utility\Error::decodeException() runs the exception - // message through \Drupal\Component\Utility\SafeMarkup::checkPlain(). $decoded_exception = Error::decodeException($exception); unset($decoded_exception['backtrace']); $message = SafeMarkup::format('%type: @message in %function (line %line of %file).
@backtrace
', $decoded_exception + array( diff --git a/core/modules/system/src/Tests/System/ErrorHandlerTest.php b/core/modules/system/src/Tests/System/ErrorHandlerTest.php index ac1d938..1bffc29 100644 --- a/core/modules/system/src/Tests/System/ErrorHandlerTest.php +++ b/core/modules/system/src/Tests/System/ErrorHandlerTest.php @@ -7,8 +7,8 @@ namespace Drupal\system\Tests\System; +use Drupal\Core\Render\SafeString; use Drupal\simpletest\WebTestBase; -use Drupal\Component\Utility\SafeMarkup; use Drupal\Component\Utility\Xss; /** @@ -183,7 +183,7 @@ function testExceptionHandler() { * Helper function: assert that the error message is found. */ function assertErrorMessage(array $error) { - $error['@message'] = SafeMarkup::xssFilter($error['@message'], Xss::getAdminTagList()); + $error['@message'] = SafeString::create(Xss::filterAdmin($error['@message'])); $message = t('%type: @message in %function (line ', $error); $this->assertRaw($message, format_string('Found error message: !message.', array('!message' => $message))); } @@ -192,7 +192,7 @@ function assertErrorMessage(array $error) { * Helper function: assert that the error message is not found. */ function assertNoErrorMessage(array $error) { - $error['@message'] = SafeMarkup::xssFilter($error['@message'], Xss::getAdminTagList()); + $error['@message'] = SafeString::create(Xss::filterAdmin($error['@message'])); $message = t('%type: @message in %function (line ', $error); $this->assertNoRaw($message, format_string('Did not find error message: @message.', array('!message' => $message))); } diff --git a/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php b/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php index e3189e4..326c60b 100644 --- a/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php +++ b/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php @@ -51,7 +51,8 @@ public function generateWarnings($collect_errors = FALSE) { $monkey_love = $bananas; // This will generate a warning. $awesomely_big = 1/0; - // This will generate a user error. We use ' to check for double escaping. + // This will generate a user error. We use ' to check for + // double escaping. trigger_error("Drupal is 'awesome'", E_USER_WARNING); return []; }