Issue Bug Under Review

#106851Form Validation fails with "token" as Form Name

George Miller 06/09/25, 15:06 updated 11/13/26, 18:06

Description

Description

If you set the name of an Extbase form, in my case that of a backend controller, to “token”, the validation of the form always fails.

Example

<f:form action="verifyPin" name="token" object="{token}">
    ...
</f:form>

Preliminary error analysis

Since the request token is apparently always transmitted as a GET parameter, the simplest solution would probably be to swap the order of this POST-GET parameter check.

Reviews 1

History 24

  1. Benni Mack commented <span data-processor="relativetime" data-value="2026-11-13T18:00:23+00:00" > 11/13/26, 18:00 </span>

    Analysis

    On main, RouteDispatcher::isValidRequest() reads the route token from the parsed body first and from the query string only as a fallback:

    $token = (string)($request->getParsedBody()['token'] ?? $request->getQueryParams()['token'] ?? '');

    Backend Extbase forms have no field name prefix, so <f:form name="token"> sends token[...] in the body. That array wins over the route token, which UriBuilder always puts into the query string. It is then cast to "Array" and the check fails.

    Letting POST win over GET is a common rule. PHP’s $_REQUEST (request_order = "GP"), Laravel’s $request->input() and Rails’ params all do that. Symfony and Django keep both sources separate, and Symfony removed the merging Request::get() in 8.0. The route token, however, is generated into the URL, so it should be read from there.

    GET links have the same problem: the backend UriBuilder adds the token with ['token' => ...] + $parameters, so a token parameter passed in by the caller replaces the generated route token.

    Option 1: Read the query string first (bugfix, main + 14.3)

    • Read token from the query string first.
    • Fall back to the parsed body only if the value there is a string, so a form’s data array is never cast to a token.
    • Extensions that post token as a plain form field keep working.
    • Fixes the POST case reported here. It does not fix the GET link case.

    Option 2: Rename the route token to _token (breaking, main only)

    • Generate _token instead of token, similar to _token in Symfony and Laravel or Extbase’s reserved __referrer and __trustedProperties.
    • Still accept token as a deprecated fallback in v15, so old URLs, open tabs and hand-built links keep working. Remove the fallback in v16.
    • Fixes both the POST and the GET collision.
    • A header is not an option: backend routes are opened by ordinary links and page loads, so the token has to stay in the URL.
    • Breaking for extensions that read token from a backend request or remove token from generated URLs by name (as core does in several places). Needs a Breaking changelog entry and a separate issue.

    Proposal: do option 1 as the bugfix for this issue. Option 2 can follow on main under a separate issue.