ps_googleanalytics 6.0.0 - HTTP 500 "Combined size of name and value cannot exceed 4096 characters" on listing pages with long URLs (ga_last_listing stores raw REQUEST_URI)
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Read classes/Hook/HookDisplayBeforeBodyClosingTag.php, especially saveInformationAboutListing(), and trace how ga_last_listing is used by HookDisplayFooterProduct. Reproduce with a long listing query string and inspect the cookie size. Done means listing pages load without a cookie size exception while the analytics listing context still has the fields it needs.
Written by the indexing model from the issue text.
Description
I'd like to report a bug in ps_googleanalytics that turns any long listing URL into a fatal error (HTTP 500).
Describe the bug
On product listing pages (category, manufacturer, etc.), saveInformationAboutListing() stores the full raw REQUEST_URI in the PrestaShop cookie as ga_last_listing. When the URL is long (for example with many filter query parameters), the encrypted cookie exceeds 4096 characters and CookieCore throws a fatal exception in __destruct(), after the page has already been rendered. This produces HTTP 500 responses.
Environment
- PrestaShop 9.1.5, multistore, PHP 8.5
- ps_googleanalytics 6.0.0 (the same code is still on
master) - AmazzingFilter 3.3.5 is also installed. Its filter state makes listing URLs very long, but it does not write to the cookie itself.
Steps to reproduce
- Install ps_googleanalytics 6.0.0 on PrestaShop 9.1.x
- Open a listing page (category or manufacturer) with a very long query string (~2,000+ characters), for example many filter parameters:
GET /brand/123-bloomcabin?autoscroll=1&available_options[c][4]=104%2C2625%2C465%2C...&available_options[f][10]=5944%2C5597&...&filters[c][4][0]=112&...&sliders[p][to]=7419&url_filters=1&url_page=1&url_sorting=1 - Observe an HTTP 500 response
Expected behavior
The listing page should load normally. Analytics listing context should not break the request when the URL is long.
Actual Result
HTTP 500. PHP fatal error:
PHP Fatal error: Uncaught PrestaShopException: Error during setting a cookie. Combined size of name and value cannot exceed 4096 characters. Larger cookie is not compliant with RFC 2965 and will not be accepted by the browser. in classes/Cookie.php:373
Stack trace:
#0 classes/Cookie.php(429): CookieCore->encryptAndSetCookie()
#1 classes/Cookie.php(396): CookieCore->write()
#2 [internal function]: CookieCore->__destruct()
#3 {main}
On 29/10/2026, a crawler sent long filtered URLs (~2,300–2,500 characters, no injection payload) to manufacturer pages and produced 875 HTTP 500 responses in about an hour. The same failure also happened on category pages with URLs of about 1,950–2,000 characters.
Root cause
classes/Hook/HookDisplayBeforeBodyClosingTag.php, saveInformationAboutListing() (lines ~244–258):
$this->context->cookie->ga_last_listing = json_encode([
'item_list_url' => $_SERVER['REQUEST_URI'],
'item_list_id' => $this->context->controller->php_self,
'item_list_name' => $listing['label'],
]);
The full raw request URI is stored in the PrestaShop cookie on every product listing page, with no length limit. The cookie is encrypted, which roughly doubles its size, so any listing URL longer than about 1,900 characters makes the cookie exceed 4,096 bytes. CookieCore then throws in __destruct(), after the page has been rendered.
Anyone can trigger this with a long query string. Real customers using filter modules with many selected options can hit it too.
Suggested fix
- Don't store the full
REQUEST_URI. Store only the path, or strip the query string, or truncate it (for example to 255 characters). Better still, only keep whatHookDisplayFooterProductreally needs (item_list_id/item_list_name). - Alternatively, skip saving
ga_last_listingwhen the encoded value is too large.
PrestaShop version where the bug happens
9.1.5
Module version where the bug happens
6.0.0 (same code still present on master)
PHP version(s) where the bug happened
8.5
Your company or customer's name goes here (if applicable).
Prestaplugins
Is a fixed version already available or planned? If needed, I can share more log details.
- Dominant language
- PHP
- Stars
- 41
- Forks
- 66
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PrestaShop/ps_googleanalytics
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 25/100
PrestaShop/ps_googleanalytics#175 · 1 comment ·
All issues in PrestaShop/ps_googleanalytics
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
taskforcesh/bullmq#5238 ·
Maintainers usually reply within 1 day
-
[Bug] v-change-database-password reports success but doesn't change the password when MySQL validate_password rejects itPossibly taken @bfs2021 claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Automattic/jetpack#55517 ·
Maintainers usually reply within 1 day
-
Major
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
PrestaShop/ps_onepagecheckout#245 ·
Maintainers usually reply within 1 day
-
wpvc
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
10up/ElasticPress#4420 ·
Maintainers usually reply within 1 day