Skip to content

Commit 49006b4

Browse files
committed
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)
2 parents 6d55422 + 2038329 commit 49006b4

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function validate($form, Constraint $constraint)
126126
if ($form->isRoot() && null !== $length) {
127127
$max = $this->serverParams->getPostMaxSize();
128128

129-
if (null !== $max && $length > $max) {
129+
if (!empty($max) && $length > $max) {
130130
$this->context->addViolation(
131131
$config->getOption('post_max_size_message'),
132132
array('{{ max }}' => $this->serverParams->getNormalizedIniPostMaxSize()),

src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ public function getPostMaxSizeFixtures()
520520
array(1024, '1K', 0, null),
521521
array(null, '1K', 0, null),
522522
array(1024, '', 0, null),
523+
array(1024, 0, 0, null),
523524
);
524525
}
525526

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy