8000 Message post_max_size_message not translated · Issue #15479 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Message post_max_size_message not translated #15479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nfourniol opened this issue Aug 6, 2015 · 7 comments
Closed

Message post_max_size_message not translated #15479

nfourniol opened this issue Aug 6, 2015 · 7 comments

Comments

@nfourniol
Copy link

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.

@xabbuh xabbuh added the Form label Aug 7, 2015
@gharlan
Copy link
Contributor
gharlan commented Sep 3, 2015

I can confirm this.

@aitboudad
Copy link
Contributor
8000

The message is translated through Validator component not in twig here, would you mind forking the standard edition, to reproduce the issue?

@gharlan
Copy link
Contributor
gharlan commented Sep 3, 2015

The message is translated through Validator component

I guess it is not translated any more since this change: #11924
The validator component is bypassed, so the translation does not happen.

@stof
Copy link
Member
stof commented Sep 3, 2015

hmm, this is indeed missing the translation here

@gharlan
Copy link
Contributor
gharlan commented Sep 3, 2015

https://github.com/gharlan/symfony-standard/tree/issue-15479

When the post_max_size is reached, the CSRF error is triggered, too. This message is translated.

screenshot 2015-09-03 15 28 19

@aitboudad
Copy link
8000
Contributor

ok thanks I'll look into it

@gharlan
Copy link
Contributor
gharlan commented Jun 22, 2016

When the post_max_size is reached, the CSRF error is triggered, too.

Do you think this is a bug? Should I open a new issue for that?

fabpot added a commit that referenced this issue Jun 22, 2016
…id Badura)

This PR was merged into the 2.7 branch.

Discussion
----------

[FORM] fix post_max_size_message translation (alt. 2)

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #15479, #18543
| License       | MIT
| Doc PR        | -

Commits
-------

9d8a5e5 fix post_max_size_message translation
@fabpot fabpot closed this as completed Jun 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants
0