From 34a8b22a2ff0e46fdad36a10ca6019a3760d1a4f Mon Sep 17 00:00:00 2001 From: Lars Lauger Date: Tue, 31 Jan 2023 17:03:11 +0100 Subject: [PATCH] BUGFIX: Don't flush if tags is an empty array FOS Varnish will call array_chunk on the given tags with the size of the tags array. If the tags are empty, an error is thrown. --- Classes/Aspects/ContentCacheAspect.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Classes/Aspects/ContentCacheAspect.php b/Classes/Aspects/ContentCacheAspect.php index feb4650..7a1b57e 100644 --- a/Classes/Aspects/ContentCacheAspect.php +++ b/Classes/Aspects/ContentCacheAspect.php @@ -129,8 +129,10 @@ public function registerDisableContentCache(JoinPointInterface $joinPoint): void public function interceptContentCacheFlush(JoinPointInterface $joinPoint) { $object = $joinPoint->getProxy(); - $tags = array_keys(ObjectAccess::getProperty($object, 'tagsToFlush', true)); + if ($tags === []) { + return; + } $this->varnishBanService->banByTags($tags); }