Commit 64143182 authored by catch's avatar catch

Issue #2386255 by aneek, rpayanm: Remove explicit sha1() call in drupal_page_cache_get_cid()

parent dedaf33c
...@@ -307,7 +307,7 @@ function drupal_page_cache_get_cid(Request $request) { ...@@ -307,7 +307,7 @@ function drupal_page_cache_get_cid(Request $request) {
$request->getUri(), $request->getUri(),
\Drupal::service('content_negotiation')->getContentType($request), \Drupal::service('content_negotiation')->getContentType($request),
); );
return sha1(implode(':', $cid_parts)); return implode(':', $cid_parts);
} }
/** /**
......
...@@ -323,7 +323,7 @@ public function testBlockCacheTags() { ...@@ -323,7 +323,7 @@ public function testBlockCacheTags() {
$this->drupalGet('<front>'); $this->drupalGet('<front>');
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT'); $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT');
$cid_parts = array(\Drupal::url('<front>', array(), array('absolute' => TRUE)), 'html'); $cid_parts = array(\Drupal::url('<front>', array(), array('absolute' => TRUE)), 'html');
$cid = sha1(implode(':', $cid_parts)); $cid = implode(':', $cid_parts);
$cache_entry = \Drupal::cache('render')->get($cid); $cache_entry = \Drupal::cache('render')->get($cid);
$expected_cache_tags = array( $expected_cache_tags = array(
'theme:classy', 'theme:classy',
...@@ -365,7 +365,7 @@ public function testBlockCacheTags() { ...@@ -365,7 +365,7 @@ public function testBlockCacheTags() {
$this->drupalGet('<front>'); $this->drupalGet('<front>');
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT'); $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT');
$cid_parts = array(\Drupal::url('<front>', array(), array('absolute' => TRUE)), 'html'); $cid_parts = array(\Drupal::url('<front>', array(), array('absolute' => TRUE)), 'html');
$cid = sha1(implode(':', $cid_parts)); $cid = implode(':', $cid_parts);
$cache_entry = \Drupal::cache('render')->get($cid); $cache_entry = \Drupal::cache('render')->get($cid);
$expected_cache_tags = array( $expected_cache_tags = array(
'theme:classy', 'theme:classy',
......
...@@ -58,7 +58,7 @@ function testPageCacheTags() { ...@@ -58,7 +58,7 @@ function testPageCacheTags() {
$this->drupalGet($path); $this->drupalGet($path);
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT'); $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT');
$cid_parts = array(\Drupal::url('system_test.cache_tags_page', array(), array('absolute' => TRUE)), 'html'); $cid_parts = array(\Drupal::url('system_test.cache_tags_page', array(), array('absolute' => TRUE)), 'html');
$cid = sha1(implode(':', $cid_parts)); $cid = implode(':', $cid_parts);
$cache_entry = \Drupal::cache('render')->get($cid); $cache_entry = \Drupal::cache('render')->get($cid);
sort($cache_entry->tags); sort($cache_entry->tags);
$expected_tags = array( $expected_tags = array(
......
...@@ -150,7 +150,7 @@ protected function verifyPageCacheTags($path, $expected_tags) { ...@@ -150,7 +150,7 @@ protected function verifyPageCacheTags($path, $expected_tags) {
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT'); $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT');
$this->assertIdentical($actual_tags, $expected_tags); $this->assertIdentical($actual_tags, $expected_tags);
$cid_parts = array(_url($path, array('absolute' => TRUE)), 'html'); $cid_parts = array(_url($path, array('absolute' => TRUE)), 'html');
$cid = sha1(implode(':', $cid_parts)); $cid = implode(':', $cid_parts);
$cache_entry = \Drupal::cache('render')->get($cid); $cache_entry = \Drupal::cache('render')->get($cid);
sort($cache_entry->tags); sort($cache_entry->tags);
$this->assertEqual($cache_entry->tags, $expected_tags); $this->assertEqual($cache_entry->tags, $expected_tags);
......
...@@ -54,7 +54,7 @@ protected function verifyPageCache($path, $hit_or_miss, $tags = FALSE) { ...@@ -54,7 +54,7 @@ protected function verifyPageCache($path, $hit_or_miss, $tags = FALSE) {
if ($hit_or_miss === 'HIT' && is_array($tags)) { if ($hit_or_miss === 'HIT' && is_array($tags)) {
$cid_parts = array(_url($path, array('absolute' => TRUE)), 'html'); $cid_parts = array(_url($path, array('absolute' => TRUE)), 'html');
$cid = sha1(implode(':', $cid_parts)); $cid = implode(':', $cid_parts);
$cache_entry = \Drupal::cache('render')->get($cid); $cache_entry = \Drupal::cache('render')->get($cid);
sort($cache_entry->tags); sort($cache_entry->tags);
$tags = array_unique($tags); $tags = array_unique($tags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment