Skip to content

Commit cfca79b

Browse files
committed
do nothing on empty queue
1 parent 0b769fc commit cfca79b

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ Changelog
33

44
See also the [GitHub releases page](https://github.com/FriendsOfSymfony/FOSHttpCache/releases).
55

6+
2.5.4
7+
-----
8+
9+
### Symfony HttpCache
10+
11+
* Fixed: Avoid regression of 2.5.3: If there are no messages to be dispatched,
12+
do not throw an exception if the HttpCache is not set.
13+
614
2.5.3
715
-----
816

src/SymfonyCache/KernelDispatcher.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,14 @@ public function invalidate(RequestInterface $invalidationRequest, $validateHost
9090
*/
9191
public function flush()
9292
{
93+
if (!count($this->queue)) {
94+
return 0;
95+
}
9396
$queue = $this->queue;
9497
$this->queue = [];
9598

9699
$exceptions = new ExceptionCollection();
97-
98100
$httpCache = $this->httpCacheProvider->getHttpCache();
99-
100101
if (null === $httpCache) {
101102
throw new ProxyUnreachableException('Kernel did not return a HttpCache instance. Did you forget $kernel->setHttpCache($cacheKernel) in your front controller?');
102103
}

0 commit comments

Comments
 (0)