Skip to content

Invalid Form Key on catalog sorting when Remember Category Pagination and cache are enabled #34686

@mrk-dzie

Description

@mrk-dzie

Preconditions (*)

  1. Remember Category Pagination option is enabled
  2. Cache is enabled
  3. Magento 2.4 or Magento 2.3.1+

Steps to reproduce

  1. Enable Full Cache and Remember Category Pagination option (catalog/frontend/remember_pagination)
  2. Visit any category page that contain products
  3. Remove cookies (or use incognito mode) and visit the same category page again.
  4. Try to change product list direction or order (the request is send by POST method and contains cached formKey not the one stored in cookies)
    Or try to change pagination count

Expected result

The toolbar action changes sorting direction and no error is displayed when cache and Remember Category Pagination are enabled

Actual result (*)

When the Remember Category Pagination option is enabled the toolbar widget is using POST method (Magento/Catalog/Block/Product/ProductList/Toolbar.php:752) and the form key is grabbed from possibly cached "formKey" options parameter. That will result an error (Invalid Form Key. Please refresh the page.) on toolbar action when full page cache is enabled and the product listing page is already cached by another user.

image


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Area: FrameworkIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P3May be fixed according to the position in the backlog.Progress: PR in progressReported on 2.4.xIndicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions