8000 Merge branch '3.2' · symfony/symfony@c958403 · GitHub
[go: up one dir, main page]

Skip to content

Commit c958403

Browse files
Merge branch '3.2'
* 3.2: minor fix purge both http and https from http cache store
2 parents 826639c + 4fcd93b commit c958403

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Tests\DependencyInjection;
1313

14-
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
14+
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\DependencyInjection\Definition;
1616
use Symfony\Component\DependencyInjection\ContainerBuilder;
1717
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;

src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ protected function setUp()
7272
$ids = range(1, 300);
7373

7474
foreach ($ids as $id) {
75-
$name = 65 + chr($id % 57);
75+
$name = 65 + (int) chr($id % 57);
7676
$this->em->persist(new SingleIntIdEntity($id, $name));
7777
}
7878

src/Symfony/Component/HttpKernel/HttpCache/Store.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,14 +317,30 @@ private function getMetadata($key)
317317
/**
318318
* Purges data for the given URL.
319319
*
320+
* This method purges both the HTTP and the HTTPS version of the cache entry.
321+
*
320322
* @param string $url A URL
321323
*
322-
* @return bool true if the URL exists and has been purged, false otherwise
324+
* @return bool true if the URL exists with either HTTP or HTTPS scheme and has been purged, false otherwise
323325
*/
324326
public function purge($url)
325327
{
326-
$key = $this->getCacheKey(Request::create($url));
328+
$http = preg_replace('#^https#', 'http', $url);
329+
$https = preg_replace('#^http#', 'https', $url);
327330

331+
return $this->doPurge($http) || $this->doPurge($https);
332+
}
333+
334+
/**
335+
* Purges data for the given URL.
336+
*
337+
* @param string $url A URL
338+
*
339+
* @return bool true if the URL exists and has been purged, false otherwise
340+
*/
341+
private function doPurge($url)
342+
{
343+
$key = $this->getCacheKey(Request::create($url));
328344
if (isset($this->locks[$key])) {
329345
flock($this->locks[$key], LOCK_UN);
330346
fclose($this->locks[$key]);

0 commit comments

Comments
 (0)
0