Verified Commit 59143d8c authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2617330 by dagmar, mfb, pradhumanjainOSL, Ratan Priya, fgm, alexpott,...

Issue #2617330 by dagmar, mfb, pradhumanjainOSL, Ratan Priya, fgm, alexpott, dawehner: LogMessageParser::parseMessagePlaceholders() needs to switch bang placeholder to colon placeholder

(cherry picked from commit c58a486d)
(cherry picked from commit 6510e5e5)
parent 7928ea7e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ public function parseMessagePlaceholders(&$message, array &$context) {
          $key = '@' . $key;
        }
      }
      if (!empty($key) && ($key[0] === '@' || $key[0] === '%' || $key[0] === '!')) {
      if (!empty($key) && ($key[0] === '@' || $key[0] === '%' || $key[0] === ':')) {
        // The key is now in \Drupal\Component\Render\FormattableMarkup style.
        $variables[$key] = $variable;
      }
+7 −0
Original line number Diff line number Diff line
@@ -63,6 +63,13 @@ public function providerTestParseMessagePlaceholders() {
        ['message' => 'Test {with} two {{encapsuled}} strings', 'context' => ['with' => 'together', 'encapsuled' => 'awesome']],
        ['message' => 'Test @with two {@encapsuled} strings', 'context' => ['@with' => 'together', '@encapsuled' => 'awesome']],
      ],

      // Test removal of unexpected placeholders like ! while allowed
      // placeholders beginning with @, % and : are preserved.
      [
        ['message' => 'Test placeholder with :url and old !bang parameter', 'context' => [':url' => 'https://drupal.org', '!bang' => 'foo bar']],
        ['message' => 'Test placeholder with :url and old !bang parameter', 'context' => [':url' => 'https://drupal.org']],
      ],
    ];
  }