diff --git a/core/lib/Drupal/Component/Render/FormattableMarkup.php b/core/lib/Drupal/Component/Render/FormattableMarkup.php index d9cb205fe64e604ca4bd281c7ee9539dcccfac84..4d6cc59ffdc555acb2337cd33e7c7278e41d8d6b 100644 --- a/core/lib/Drupal/Component/Render/FormattableMarkup.php +++ b/core/lib/Drupal/Component/Render/FormattableMarkup.php @@ -233,13 +233,8 @@ protected static function placeholderFormat($string, array $args) { break; default: - // Deprecate support for random variables that won't be replaced. - if (ctype_alpha($key[0]) && strpos($string, $key) === FALSE) { - @trigger_error(sprintf('Support for keys without a placeholder prefix is deprecated in Drupal 9.1.0 and will be removed in Drupal 10.0.0. Invalid placeholder (%s) with string: "%s"', $key, $string), E_USER_DEPRECATED); - } - else { - trigger_error(sprintf('Invalid placeholder (%s) with string: "%s"', $key, $string), E_USER_WARNING); - } + // Warn for random variables that won't be replaced. + trigger_error(sprintf('Invalid placeholder (%s) with string: "%s"', $key, $string), E_USER_WARNING); // No replacement possible therefore we can discard the argument. unset($args[$key]); break; diff --git a/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php b/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php index fc285287e1e3546e5bcbc0f0b5b97500c77d369c..4c008a9b652e6c5c2d54087562e45b200ca461dc 100644 --- a/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php +++ b/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php @@ -99,17 +99,8 @@ public function providerTestUnexpectedPlaceholder() { // Ensure that where the placeholder is located in the string is // irrelevant. ['placeholder', ['placeholder' => 'replaced'], E_USER_WARNING, 'Invalid placeholder (placeholder) with string: "placeholder"'], + ['No replacements', ['foo' => 'bar'], E_USER_WARNING, 'Invalid placeholder (foo) with string: "No replacements"'], ]; } - /** - * @group legacy - */ - public function testNoReplacementUnsupportedVariable() { - $this->expectDeprecation('Support for keys without a placeholder prefix is deprecated in Drupal 9.1.0 and will be removed in Drupal 10.0.0. Invalid placeholder (foo) with string: "No replacements"'); - $markup = new FormattableMarkup('No replacements', ['foo' => 'bar']); - // Cast it to a string which will generate the deprecation notice. - $output = (string) $markup; - } - }