Skip to content

fix(formit): filter AJAX config before session/cache writes#310

Open
Ibochkarev wants to merge 1 commit into
Sterc:3.xfrom
Ibochkarev:fix/issue-308-serialization
Open

fix(formit): filter AJAX config before session/cache writes#310
Ibochkarev wants to merge 1 commit into
Sterc:3.xfrom
Ibochkarev:fix/issue-308-serialization

Conversation

@Ibochkarev

@Ibochkarev Ibochkarev commented Jul 23, 2026

Copy link
Copy Markdown

Filter FormIt snippet config before session and MODX file cache writes for AJAX.

Since 5.2.0, Request::prepare() stored the full $this->config for AJAX tokens. On PHP 8.4 that payload can hold Closures, objects, resources, and internal arrays. Session shutdown throws Serialization of 'Closure' is not allowed. MODX cache writes throw var_export does not handle circular references. After the first FormIt render, any request with that session returns HTTP 500.

getStorableAjaxConfig() in Request.php keeps null and scalar snippet properties. lexicons and permissions rebuild when action.php creates a new FormIt instance. pageId stays int|null. bootstrap.php unchanged.

Version 5.2.5.

Fixes #308

@Ibochkarev
Ibochkarev force-pushed the fix/issue-308-serialization branch from 37cbd50 to 46b418b Compare July 23, 2026 05:20
Keep only scalar snippet properties before storing FormIt config for
AJAX handling in session and MODX cache. Fixes HTTP 500 on PHP 8.4.
@Ibochkarev
Ibochkarev force-pushed the fix/issue-308-serialization branch from 46b418b to 252f198 Compare July 23, 2026 05:25
@Ibochkarev
Ibochkarev marked this pull request as ready for review July 23, 2026 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FormIt 5.2.3-pl causes HTTP 500 on MODX 3 / PHP 8.4.4

1 participant