I’m integrating PHPMaker (2026.10) with Symfony CSRF validation and I’m seeing inconsistent behavior between API requests and normal form submissions.
1. API request (FAILS CSRF)
Route:
phpmaker2026_azkayra_apiaction_dispatcher
CSRF data:
csrfId: submit
tokenValue: kPVSrGtZarfBHpCN6tSx_Z2m
Cookies:
csrf-token_kPVSrGtZarfBHpCN6tSx_Z2m = csrf-token
Cookie name is generated correctly, but Symfony CSRF validation still fails (403 Forbidden).
2. Standard form submit (WORKS)
Route:
add.platform_positions
CSRF data:
csrfId: submit
tokenValue: 7H4Ft6-_3oDw6802i53BLKQf
Cookies:
csrf-token_ = csrf-token (empty suffix)
Despite the incomplete cookie key, the request passes CSRF validation.
Symfony validation code
if (!$tokenValue || !$this->csrfTokenManager->isTokenValid(new CsrfToken($csrfId, $tokenValue))) {
throw new AccessDeniedHttpException('Invalid CSRF token');
}
Problem summary
The behavior is inconsistent:
-
In API requests:
-
PHPMaker generates a proper stateless CSRF cookie name:
csrf-token_<token> -
But Symfony still rejects the request.
-
-
In normal form submissions:
-
Cookie name is incomplete:
csrf-token_ -
But Symfony accepts the request.
-
Question
Is this expected behavior in PHPMaker 2026 stateless CSRF implementation, or is there a mismatch in how generateCsrfToken() handles cookie generation between:
-
fetch/API submissions
-
standard form POST submissions
Also, what is the correct/official way to make CSRF validation consistent across both flows without breaking Symfony security or modifying its core CSRF logic?
If there is a recommended configuration or integration pattern for PHPMaker + Symfony stateless CSRF, I would appreciate guidance.