From bf958526c74c2d27962c025f2559a01284a84ff1 Mon Sep 17 00:00:00 2001 From: boo-code Date: Mon, 2 Nov 2026 10:36:49 +0100 Subject: [PATCH] Store only the listing path in the last listing cookie saveInformationAboutListing() stored the raw REQUEST_URI in the ga_last_listing cookie. With a long query string (listing filters, crawlers), the encrypted cookie went over 4096 bytes and Cookie threw while writing it, after the page was rendered. The path, capped at 255 characters, is enough for HookDisplayFooterProduct to match the product page referer. --- classes/Hook/HookDisplayBeforeBodyClosingTag.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/classes/Hook/HookDisplayBeforeBodyClosingTag.php b/classes/Hook/HookDisplayBeforeBodyClosingTag.php index 24e3a8c..acf8578 100644 --- a/classes/Hook/HookDisplayBeforeBodyClosingTag.php +++ b/classes/Hook/HookDisplayBeforeBodyClosingTag.php @@ -250,8 +250,10 @@ private function saveInformationAboutListing() } // Save this information to a cookie + // WHY: the query string is left out, listing filters can make it long enough for the cookie to exceed + // the 4096 bytes Cookie accepts, and Cookie then throws. The path still matches the product page referer. $this->context->cookie->ga_last_listing = json_encode([ - 'item_list_url' => $_SERVER['REQUEST_URI'], + 'item_list_url' => substr(strtok($_SERVER['REQUEST_URI'], '?'), 0, 255), 'item_list_id' => $this->context->controller->php_self, 'item_list_name' => $listing['label'], ]);