Skip to content

Commit f6402ff

Browse files
Merge branch '4.4' into 5.4
* 4.4: Fix composer on appveyor [PropertyAccess] Fix typo in PropertyAccessor::readProperty() DocBlock [VarExporter] Fix exporting objects with readonly properties [ExpressionLanguage] Fix matches when the regexp is not valid [Messenger] Add mysql indexes back and work around deadlocks using soft-delete [Validator] Fix File constraint invalid max size exception message [Console] Fix exit status on uncaught exception with negative code
2 parents e32e24f + 86464b6 commit f6402ff

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Constraints/File.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ private function normalizeBinaryFormat($maxSize)
168168
$this->maxSize = $matches[1] * $factors[$unit = strtolower($matches[2])];
169169
$this->binaryFormat = $this->binaryFormat ?? (2 === \strlen($unit));
170170
} else {
171-
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum size.', $this->maxSize));
171+
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum size.', $maxSize));
172172
}
173173
}
174174
}

Tests/Constraints/FileValidatorTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,5 +526,14 @@ public function uploadedFileErrorProvider()
526526
return $tests;
527527
}
528528

529+
public function testNegativeMaxSize()
530+
{
531+
$this->expectException(ConstraintDefinitionException::class);
532+
$this->expectExceptionMessage('"-1" is not a valid maximum size.');
533+
534+
$file = new File();
535+
$file->maxSize = -1;
536+
}
537+
529538
abstract protected function getFile($filename);
530539
}

0 commit comments

Comments
 (0)