merged branch odi86/check-post-max-size-zero (PR #8149)
This PR was merged into the 2.1 branch.
Discussion
----------
[Form] [Validator] Fixed post_max_size = 0 bug (issue #8065)
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #8065
| License | MIT
| Doc PR |
Commits
-------
2038329
[Form] [Validator] Fixed post_max_size = 0 bug (Issue #8065)
This commit is contained in:
commit
49006b42a9
@ -126,7 +126,7 @@ class FormValidator extends ConstraintValidator
|
|||||||
if ($form->isRoot() && null !== $length) {
|
if ($form->isRoot() && null !== $length) {
|
||||||
$max = $this->serverParams->getPostMaxSize();
|
$max = $this->serverParams->getPostMaxSize();
|
||||||
|
|
||||||
if (null !== $max && $length > $max) {
|
if (!empty($max) && $length > $max) {
|
||||||
$this->context->addViolation(
|
$this->context->addViolation(
|
||||||
$config->getOption('post_max_size_message'),
|
$config->getOption('post_max_size_message'),
|
||||||
array('{{ max }}' => $this->serverParams->getNormalizedIniPostMaxSize()),
|
array('{{ max }}' => $this->serverParams->getNormalizedIniPostMaxSize()),
|
||||||
|
@ -520,6 +520,7 @@ class FormValidatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
array(1024, '1K', 0, null),
|
array(1024, '1K', 0, null),
|
||||||
array(null, '1K', 0, null),
|
array(null, '1K', 0, null),
|
||||||
array(1024, '', 0, null),
|
array(1024, '', 0, null),
|
||||||
|
array(1024, 0, 0, null),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user