[Form] [Validator] Fixed post_max_size = 0 bug (Issue #8065)
This commit is contained in:
parent
d52d9aeba0
commit
2038329114
@ -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