Loading core/lib/Drupal/Component/Render/FormattableMarkup.php +4 −2 Original line number Diff line number Diff line Loading @@ -241,8 +241,10 @@ protected static function placeholderFormat($string, array $args) { break; default: // Warn for random variables that won't be replaced. if (!ctype_alnum($key[0])) { // Warn for random placeholders 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; Loading core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php +4 −4 Original line number Diff line number Diff line Loading @@ -117,12 +117,12 @@ public function testUnexpectedPlaceholder($string, $arguments, $error_number, $e */ public function providerTestUnexpectedPlaceholder() { return [ ['Non alpha starting character: ~placeholder', ['~placeholder' => 'replaced'], E_USER_WARNING, 'Invalid placeholder (~placeholder) with string: "Non alpha starting character: ~placeholder"'], ['Alpha starting character: placeholder', ['placeholder' => 'replaced'], E_USER_WARNING, 'Invalid placeholder (placeholder) with string: "Alpha starting character: placeholder"'], ['Non alpha, non-allowed starting character: ~placeholder', ['~placeholder' => 'replaced'], E_USER_WARNING, 'Invalid placeholder (~placeholder) with string: "Non alpha, non-allowed starting character: ~placeholder"'], ['Alpha starting character: placeholder', ['placeholder' => 'replaced'], NULL, ''], // 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"'], ['placeholder', ['placeholder' => 'replaced'], NULL, ''], ['No replacements', ['foo' => 'bar'], NULL, ''], ]; } Loading Loading
core/lib/Drupal/Component/Render/FormattableMarkup.php +4 −2 Original line number Diff line number Diff line Loading @@ -241,8 +241,10 @@ protected static function placeholderFormat($string, array $args) { break; default: // Warn for random variables that won't be replaced. if (!ctype_alnum($key[0])) { // Warn for random placeholders 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; Loading
core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php +4 −4 Original line number Diff line number Diff line Loading @@ -117,12 +117,12 @@ public function testUnexpectedPlaceholder($string, $arguments, $error_number, $e */ public function providerTestUnexpectedPlaceholder() { return [ ['Non alpha starting character: ~placeholder', ['~placeholder' => 'replaced'], E_USER_WARNING, 'Invalid placeholder (~placeholder) with string: "Non alpha starting character: ~placeholder"'], ['Alpha starting character: placeholder', ['placeholder' => 'replaced'], E_USER_WARNING, 'Invalid placeholder (placeholder) with string: "Alpha starting character: placeholder"'], ['Non alpha, non-allowed starting character: ~placeholder', ['~placeholder' => 'replaced'], E_USER_WARNING, 'Invalid placeholder (~placeholder) with string: "Non alpha, non-allowed starting character: ~placeholder"'], ['Alpha starting character: placeholder', ['placeholder' => 'replaced'], NULL, ''], // 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"'], ['placeholder', ['placeholder' => 'replaced'], NULL, ''], ['No replacements', ['foo' => 'bar'], NULL, ''], ]; } Loading