Skip to content

Message post_max_size_message not translated #15479

@nfourniol

Description

@nfourniol

When in a symfony application we upload a big file, this upload causes POST request to exceed PHP post_max_size variable defined in php.ini (if file size exceed post_max_size),
Symfony framework manage this error, but it seems there is a regression -->

In Vendor FormType.php, the function configureOptions set a default attribute 'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.'

Then in NativeRequestHandler

$form->addError(new FormError(
                $form->getConfig()->getOption('post_max_size_message'),
                null,
                array('{{ max }}' => $this->serverParams->getNormalizedIniPostMaxSize())
 ));

As we can see, the message $form->getConfig()->getOption('post_max_size_message') is not translated. Or in twig the form errors are displayed without doing a {{ error|trans }} (see in vendor twig templates the definition of the block form_errors) then in our generated html pages we have form errors all translated but this one. All the form error messages must be translated before being passed as a parameter to new FormError(...).

There is the same problem in HttpFoundationRequestHandler.

I verified that all other new FormError(...) declared in vendors take a translated message as parameter and it's the case.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions