File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
src/Symfony/Component/Validator Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ private function normalizeBinaryFormat($maxSize)
117
117
$ this ->maxSize = $ matches [1 ] * $ factors [$ unit = strtolower ($ matches [2 ])];
118
118
$ this ->binaryFormat = $ this ->binaryFormat ?? (2 === \strlen ($ unit ));
119
119
} else {
120
- throw new ConstraintDefinitionException (sprintf ('"%s" is not a valid maximum size. ' , $ this -> maxSize ));
120
+ throw new ConstraintDefinitionException (sprintf ('"%s" is not a valid maximum size. ' , $ maxSize ));
121
121
}
122
122
}
123
123
}
Original file line number Diff line number Diff line change @@ -479,5 +479,14 @@ public function uploadedFileErrorProvider()
479
479
return $ tests ;
480
480
}
481
481
482
+ public function testNegativeMaxSize ()
483
+ {
484
+ $ this ->expectException (ConstraintDefinitionException::class);
485
+ $ this ->expectExceptionMessage ('"-1" is not a valid maximum size. ' );
486
+
487
+ $ file = new File ();
488
+ $ file ->maxSize = -1 ;
489
+ }
490
+
482
491
abstract protected function getFile ($ filename );
483
492
}
You can’t perform that action at this time.
0 commit comments