Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit be3c0dc

Browse files
committed
bug #10904 [HttpKernel] Replace sha1 with sha256 in recently added tests (jakzal)
This PR was merged into the 2.4 branch. Discussion ---------- [HttpKernel] Replace sha1 with sha256 in recently added tests | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | no | Fixed tickets | - | License | MIT Tests were introduced in #10896 and are broken starting with 2.4, since the hashing algorithm has changed (introduced in #8609). Commits ------- 255544f [HttpKernel] Replace sha1 with sha256 in recently added tests.
2 parents 35a0ee6 + 255544f commit be3c0dc

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -609,12 +609,11 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft
609609
$values = $this->getMetaStorageValues();
610610
$this->assertCount(1, $values);
611611
$tmp = unserialize($values[0]);
612-
$time = \DateTime::createFromFormat('U', time());
613612
$tmp[0][1]['date'] = \DateTime::createFromFormat('U', time() - 5)->format(DATE_RFC2822);
614613
$r = new \ReflectionObject($this->store);
615614
$m = $r->getMethod('save');
616615
$m->setAccessible(true);
617-
$m->invoke($this->store, 'md'.sha1('http://localhost/'), serialize($tmp));
616+
$m->invoke($this->store, 'md'.hash('sha256', 'http://localhost/'), serialize($tmp));
618617

619618
$this->request('GET', '/');
620619
$this->assertHttpKernelIsCalled();
@@ -659,12 +658,11 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft
659658
$values = $this->getMetaStorageValues();
660659
$this->assertCount(1, $values);
661660
$tmp = unserialize($values[0]);
662-
$time = \DateTime::createFromFormat('U', time());
663661
$tmp[0][1]['date'] = \DateTime::createFromFormat('U', time() - 5)->format(DATE_RFC2822);
664662
$r = new \ReflectionObject($this->store);
665663
$m = $r->getMethod('save');
666664
$m->setAccessible(true);
667-
$m->invoke($this->store, 'md'.sha1('http://localhost/'), serialize($tmp));
665+
$m->invoke($this->store, 'md'.hash('sha256', 'http://localhost/'), serialize($tmp));
668666

669667
$this->request('GET', '/');
670668
$this->assertHttpKernelIsCalled();

0 commit comments

Comments
 (0)