getgrav/grav · error · RuntimeException

FlexForm: Bad HTTP method %s

Error message

FlexForm: Bad HTTP method %s

What it means

Error "FlexForm: Bad HTTP method %s" thrown in getgrav/grav.

Source

Thrown at system/src/Grav/Framework/Form/Traits/FormTrait.php:716

        return $twig->twig()->resolveTemplate(
            [
                "forms/{$layout}/form.html.twig",
                'forms/default/form.html.twig'
            ]
        );
    }

    /**
     * Parse PSR-7 ServerRequest into data and files.
     *
     * @param ServerRequestInterface $request
     * @return array
     */
    protected function parseRequest(ServerRequestInterface $request): array
    {
        $method = $request->getMethod();
        if (!in_array($method, ['PUT', 'POST', 'PATCH'])) {
            throw new RuntimeException(sprintf('FlexForm: Bad HTTP method %s', $method));
        }

        $body = (array)$request->getParsedBody();
        $data = isset($body['data']) ? $this->decodeData($body['data']) : null;

        $flash = $this->getFlash();
        /*
        if (null !== $data) {
            $flash->setData($data);
            $flash->save();
        }
        */

        $blueprint = $this->getBlueprint();
        $includeOriginal = (bool)($blueprint->form()['images']['original'] ?? null);
        $files = $flash->getFilesByFields($includeOriginal);

        $data = $blueprint->processForm($data ?? [], $body['toggleable_data'] ?? []);

View on GitHub (pinned to 6040efed04)

When it happens

Trigger: Thrown at system/src/Grav/Framework/Form/Traits/FormTrait.php:716 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of getgrav/grav@6040efed04 (2026-08-17). Data as JSON: /api/errors/47ad3953e740105c. Report an issue: GitHub.