File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -217,7 +217,7 @@ public static function getMaxFilesize()
217
217
$ sizePostMax = self ::parseFilesize (ini_get ('post_max_size ' ));
218
218
$ sizeUploadMax = self ::parseFilesize (ini_get ('upload_max_filesize ' ));
219
219
220
- return min ([ $ sizePostMax , $ sizeUploadMax] );
220
+ return min ($ sizePostMax ?: PHP_INT_MAX , $ sizeUploadMax ?: PHP_INT_MAX );
221
221
}
222
222
223
223
/**
Original file line number Diff line number Diff line change @@ -281,4 +281,18 @@ public function testIsInvalidIfNotHttpUpload()
281
281
282
282
$ this ->assertFalse ($ file ->isValid ());
283
283
}
284
+
285
+ public function testGetMaxFilesize ()
286
+ {
287
+ $ size = UploadedFile::getMaxFilesize ();
288
+
289
+ $ this ->assertIsInt ($ size );
290
+ $ this ->assertGreaterThan (0 , $ size );
291
+
292
+ if (0 === (int ) ini_get ('post_max_size ' ) && 0 === (int ) ini_get ('upload_max_filesize ' )) {
293
+ $ this ->assertSame (PHP_INT_MAX , $ size );
294
+ } else {
295
+ $ this ->assertLessThan (PHP_INT_MAX , $ size );
296
+ }
297
+ }
284
298
}
You can’t perform that action at this time.
0 commit comments