From 83259f7ae4788a656cdfd54654be7b82bed34bf7 Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Tue, 18 Jul 2023 12:19:50 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20fix=20cookie=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Classes/Hook/DatamapHook.php | 7 +++++-- Classes/Service/CookieService.php | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Classes/Hook/DatamapHook.php b/Classes/Hook/DatamapHook.php index 1c0c85884c5..3e0d1f1bd80 100644 --- a/Classes/Hook/DatamapHook.php +++ b/Classes/Hook/DatamapHook.php @@ -23,7 +23,10 @@ class DatamapHook extends AbstractHook */ public function processDatamap_afterDatabaseOperations($status, $table, $id, $fieldArray, DataHandler $dataHandler): void { - if ('pages' !== $table || !MathUtility::canBeInterpretedAsInteger($id)) { + if ('pages' !== $table) { + return; + } + if (!MathUtility::canBeInterpretedAsInteger($id)) { return; } @@ -31,7 +34,7 @@ public function processDatamap_afterDatabaseOperations($status, $table, $id, $fi $allowSfc = (bool) $row['tx_staticfilecache_cache']; if (!$allowSfc) { try { - // Delete cache + // Delete right now!! do not wait until queue is deleting this $configuration = GeneralUtility::makeInstance(ConfigurationService::class); $configuration->override('boostMode', '0'); $cacheService = GeneralUtility::makeInstance(CacheService::class); diff --git a/Classes/Service/CookieService.php b/Classes/Service/CookieService.php index b546258e574..224407e7505 100644 --- a/Classes/Service/CookieService.php +++ b/Classes/Service/CookieService.php @@ -28,6 +28,9 @@ public function __construct(private DateTimeService $dateTimeService) */ public function setCookie(int $lifetime): void { + if ($lifetime !== self::SESSION_LIFETIME) { + $lifetime += $this->dateTimeService->getCurrentTime(); + } setcookie(self::FE_COOKIE_NAME, 'typo_user_logged_in', $lifetime + $this->dateTimeService->getCurrentTime(), '/', $this->getCookieDomain(), GeneralUtility::getIndpEnv('TYPO3_SSL')); } @@ -36,7 +39,7 @@ public function setCookie(int $lifetime): void */ public function unsetCookie(): void { - $this->setCookie( -3600); + $this->setCookie(-3600); } public function hasCookie(): bool From 3e7f147f5b5d2388ffad7f3c5109d5706d8c2c2c Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Tue, 25 Jul 2023 14:29:52 +0200 Subject: [PATCH 2/2] Update Classes/Service/CookieService.php --- Classes/Service/CookieService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Service/CookieService.php b/Classes/Service/CookieService.php index 224407e7505..bcf88c30800 100644 --- a/Classes/Service/CookieService.php +++ b/Classes/Service/CookieService.php @@ -31,7 +31,7 @@ public function setCookie(int $lifetime): void if ($lifetime !== self::SESSION_LIFETIME) { $lifetime += $this->dateTimeService->getCurrentTime(); } - setcookie(self::FE_COOKIE_NAME, 'typo_user_logged_in', $lifetime + $this->dateTimeService->getCurrentTime(), '/', $this->getCookieDomain(), GeneralUtility::getIndpEnv('TYPO3_SSL')); + setcookie(self::FE_COOKIE_NAME, 'typo_user_logged_in', $lifetime, '/', $this->getCookieDomain(), GeneralUtility::getIndpEnv('TYPO3_SSL')); } /**