From 5082019eaa4e632882c4017ecead4bb5a1a9db94 Mon Sep 17 00:00:00 2001 From: webchick <webchick@24967.no-reply.drupal.org> Date: Sat, 9 Feb 2013 03:33:57 -0800 Subject: [PATCH] Issue #1884830 by pwolanin: Fixed Regression - replace md5 in Filter module calls with sha2 hashes. --- core/modules/filter/filter.module | 2 +- .../lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index dfb5d682405b..fb7ea4c1f9b1 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -1626,7 +1626,7 @@ function _filter_url_escape_comments($match, $escape = NULL) { // Replace all HTML coments with a '<!-- [hash] -->' placeholder. if ($mode) { $content = $match[1]; - $hash = md5($content); + $hash = hash('sha256', $content); $comments[$hash] = $content; return "<!-- $hash -->"; } diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php index 8c95150e91f7..644781e126a7 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php @@ -113,7 +113,7 @@ function testImageSource() { $comment[] = $image . ':'; // Hash the image source in a custom test attribute, because it might // contain characters that confuse XPath. - $comment[] = '<img src="' . $image . '" testattribute="' . md5($image) . '" />'; + $comment[] = '<img src="' . $image . '" testattribute="' . hash('sha256', $image) . '" />'; } $edit = array( 'comment_body[und][0][value]' => implode("\n", $comment), @@ -121,7 +121,7 @@ function testImageSource() { $this->drupalPost('node/' . $this->node->nid, $edit, t('Save')); foreach ($images as $image => $converted) { $found = FALSE; - foreach ($this->xpath('//img[@testattribute="' . md5($image) . '"]') as $element) { + foreach ($this->xpath('//img[@testattribute="' . hash('sha256', $image) . '"]') as $element) { $found = TRUE; if ($converted == $red_x_image) { $this->assertEqual((string) $element['src'], $red_x_image); -- GitLab