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:
Fabien Potencier 2013-06-02 14:03:10 +02:00
commit 49006b42a9
2 changed files with 2 additions and 1 deletions

View File

@ -126,7 +126,7 @@ class FormValidator extends ConstraintValidator
if ($form->isRoot() && null !== $length) {
$max = $this->serverParams->getPostMaxSize();
if (null !== $max && $length > $max) {
if (!empty($max) && $length > $max) {
$this->context->addViolation(
$config->getOption('post_max_size_message'),
array('{{ max }}' => $this->serverParams->getNormalizedIniPostMaxSize()),

View File

@ -520,6 +520,7 @@ class FormValidatorTest extends \PHPUnit_Framework_TestCase
array(1024, '1K', 0, null),
array(null, '1K', 0, null),
array(1024, '', 0, null),
array(1024, 0, 0, null),
);
}