File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed 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)
117117 $ this ->maxSize = $ matches [1 ] * $ factors [$ unit = strtolower ($ matches [2 ])];
118118 $ this ->binaryFormat = $ this ->binaryFormat ?? (2 === \strlen ($ unit ));
119119 } 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 ));
121121 }
122122 }
123123}
Original file line number Diff line number Diff line change @@ -479,5 +479,14 @@ public function uploadedFileErrorProvider()
479479 return $ tests ;
480480 }
481481
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+
482491 abstract protected function getFile ($ filename );
483492}
You can’t perform that action at this time.
0 commit comments