commit f1d33c628bd2a98b89a8e3e5187e6ac9d88fd70c Author: Joel Pittet Date: Tue Sep 8 15:47:07 2015 -0700 fixes diff --git a/core/lib/Drupal/Component/Utility/SafeMarkup.php b/core/lib/Drupal/Component/Utility/SafeMarkup.php index 1635d49..268cbe7 100644 --- a/core/lib/Drupal/Component/Utility/SafeMarkup.php +++ b/core/lib/Drupal/Component/Utility/SafeMarkup.php @@ -228,7 +228,6 @@ public static function format($string, array $args) { // safe. if (!static::isSafe($value)) { // Escape and filter bad protocols. - $value = Html::escape($value); $args[$key] = UrlHelper::filterBadProtocol($value); } } diff --git a/core/modules/block/src/Tests/BlockXssTest.php b/core/modules/block/src/Tests/BlockXssTest.php index 3d9bfd3..7b64dd5 100644 --- a/core/modules/block/src/Tests/BlockXssTest.php +++ b/core/modules/block/src/Tests/BlockXssTest.php @@ -80,7 +80,7 @@ protected function doViewTest() { $this->drupalGet(Url::fromRoute('block.admin_display')); $this->clickLinkPartialName('Place block'); // The block admin label is automatically XSS admin filtered. - $this->assertRaw('alert("view");'); + $this->assertRaw('alert("view");'); $this->assertNoRaw(''); } diff --git a/core/modules/config/src/Tests/ConfigImporterTest.php b/core/modules/config/src/Tests/ConfigImporterTest.php index e39baf6..78f7e91 100644 --- a/core/modules/config/src/Tests/ConfigImporterTest.php +++ b/core/modules/config/src/Tests/ConfigImporterTest.php @@ -295,7 +295,7 @@ function testSecondaryWriteSecondaryFirst() { $logs = $this->configImporter->getErrors(); $this->assertEqual(count($logs), 1); - $message = SafeMarkup::format("'config_test' entity with ID '@name' already exists", array('@name' => 'secondary')); + $message = "'config_test' entity with ID 'secondary' already exists"; $this->assertEqual($logs[0], SafeMarkup::format('Unexpected error during import with operation @op for @name: !message.', array('@op' => 'create', '@name' => $name_primary, '!message' => $message))); } diff --git a/core/modules/node/src/Tests/PageEditTest.php b/core/modules/node/src/Tests/PageEditTest.php index 31d6ea9..1665fbe 100644 --- a/core/modules/node/src/Tests/PageEditTest.php +++ b/core/modules/node/src/Tests/PageEditTest.php @@ -54,7 +54,7 @@ function testPageEdit() { $this->assertUrl($node->url('edit-form', ['absolute' => TRUE])); // Check that the title and body fields are displayed with the correct values. - $active = '' . t('(active tab)') . ''; + $active = t('@label', array('@label' => t('(active tab)'))); $link_text = t('!local-task-title!active', array('!local-task-title' => t('Edit'), '!active' => $active)); $this->assertText(strip_tags($link_text), 0, 'Edit tab found and marked active.'); $this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.'); diff --git a/core/modules/system/src/Tests/Theme/TwigTransTest.php b/core/modules/system/src/Tests/Theme/TwigTransTest.php index 52c751e..b9a17ca 100644 --- a/core/modules/system/src/Tests/Theme/TwigTransTest.php +++ b/core/modules/system/src/Tests/Theme/TwigTransTest.php @@ -140,7 +140,7 @@ protected function assertTwigTransTags() { // @see \Drupal\Core\Template\TwigNodeTrans::compileString() $this->assertRaw( - 'Y U NO LET ME XSS: &"<>', + 'Y U NO LET ME XSS: <script>&"<></script>', '{{ token|passthrough }} (unsafe) was successfully translated and prefixed with "!".' ); @@ -155,7 +155,7 @@ protected function assertTwigTransTags() { ); $this->assertRaw( - 'DIS complex token HAZ LENGTH OV: 3. IT CONTAYNZ: 12345 AN <script>&"<></script>. LETS FIRRTER TEH BAD TXT: &"<>', + 'DIS complex token HAZ LENGTH OV: 3. IT CONTAYNZ: 12345 AN <script>&"<></script>. LETS ESCAPEE TEH BAD TXT: <script>&"<></script>', '{{ complex.tokens }} were successfully translated with appropriate prefixes.' ); @@ -268,8 +268,8 @@ protected function poFileContents($langcode) { msgid "Placeholder: %string" msgstr "PLAYSHOLDR: %string" -msgid "This @token.name has a length of: @count. It contains: %token.numbers and @token.bad_text. Let's filter the bad text: !token.bad_text." -msgstr "DIS @token.name HAZ LENGTH OV: @count. IT CONTAYNZ: %token.numbers AN @token.bad_text. LETS FIRRTER TEH BAD TXT: !token.bad_text." +msgid "This @token.name has a length of: @count. It contains: %token.numbers and @token.bad_text. Let's escape the bad text: !token.bad_text." +msgstr "DIS @token.name HAZ LENGTH OV: @count. IT CONTAYNZ: %token.numbers AN @token.bad_text. LETS ESCAPEE TEH BAD TXT: !token.bad_text." msgctxt "Lolspeak" msgid "I have context." diff --git a/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.trans.html.twig b/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.trans.html.twig index 7d1d406..28a5390 100644 --- a/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.trans.html.twig +++ b/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.trans.html.twig @@ -79,7 +79,7 @@ {% set count = token|length %}
{% trans %} - This {{ token.name }} has a length of: {{ count }}. It contains: {{ token.numbers|placeholder }} and {{ token.bad_text }}. Let's filter the bad text: {{ token.bad_text|passthrough }}. + This {{ token.name }} has a length of: {{ count }}. It contains: {{ token.numbers|placeholder }} and {{ token.bad_text }}. Let's escape the bad text: {{ token.bad_text|passthrough }}. {% endtrans %}
diff --git a/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php b/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php index 32f9809..8086e49 100644 --- a/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php @@ -216,7 +216,7 @@ function providerFormat() { $tests[] = array('Escaped text: @value', array('@value' => SafeMarkupTestSafeString::create('Safe HTML')), 'Escaped text: Safe HTML', 'SafeMarkup::format does not escape an already safe string.'); $tests[] = array('Placeholder text: %value', array('%value' => '