@@ -328,15 +328,25 @@ function ($cfgValue) { return $cfgValue > 100; },
328
328
329
329
$ this ->addPhpConfigRecommendation (
330
330
'post_max_size ' ,
331
- $ this ->getPostMaxSize () < $ this ->getMemoryLimit (),
331
+ function () {
332
+ $ memoryLimit = $ this ->getMemoryLimit ();
333
+ $ postMaxSize = $ this ->getPostMaxSize ();
334
+
335
+ return \INF === $ memoryLimit || \INF === $ postMaxSize || $ memoryLimit > $ postMaxSize ;
336
+ },
332
337
true ,
333
338
'"memory_limit" should be greater than "post_max_size". ' ,
334
339
'Set "<strong>memory_limit</strong>" to be greater than "<strong>post_max_size</strong>". '
335
340
);
336
341
337
342
$ this ->addPhpConfigRecommendation (
338
343
'upload_max_filesize ' ,
339
- $ this ->getUploadMaxFilesize () < $ this ->getPostMaxSize (),
344
+ function () {
345
+ $ postMaxSize = $ this ->getPostMaxSize ();
346
+ $ uploadMaxFilesize = $ this ->getUploadMaxFilesize ();
347
+
348
+ return \INF === $ postMaxSize || \INFO === $ uploadMaxFilesize || $ postMaxSize > $ uploadMaxFilesize ;
349
+ },
340
350
true ,
341
351
'"post_max_size" should be greater than "upload_max_filesize". ' ,
342
352
'Set "<strong>post_max_size</strong>" to be greater than "<strong>upload_max_filesize</strong>". '
@@ -363,19 +373,20 @@ class_exists('PDO'),
363
373
* (e.g. 16k is converted to 16384 int)
364
374
*
365
375
* @param string $size - Shorthand size
376
+ * @param string $infiniteValue - The infinite value for this setting
366
377
*
367
378
* @see http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
368
379
*
369
380
* @return int - Converted size
370
381
*/
371
- private function convertShorthandSize ($ size )
382
+ private function convertShorthandSize ($ size, $ infiniteValue = ' -1 ' )
372
383
{
373
384
// Initialize
374
385
$ size = trim ($ size );
375
386
$ unit = '' ;
376
387
377
388
// Check unlimited alias
378
- if ($ size === ' -1 ' ) {
389
+ if ($ size === $ infiniteValue ) {
379
390
return \INF ;
380
391
}
381
392
@@ -417,7 +428,7 @@ private function getRealpathCacheSize()
417
428
*/
418
429
private function getPostMaxSize ()
419
430
{
420
- return $ this ->convertShorthandSize (ini_get ('post_max_size ' ));
431
+ return $ this ->convertShorthandSize (ini_get ('post_max_size ' ), ' 0 ' );
421
432
}
422
433
423
434
/**
@@ -437,7 +448,7 @@ private function getMemoryLimit()
437
448
*/
438
449
private function getUploadMaxFilesize ()
439
450
{
440
- return $ this ->convertShorthandSize (ini_get ('upload_max_filesize ' ));
451
+ return $ this ->convertShorthandSize (ini_get ('upload_max_filesize ' ), ' 0 ' );
441
452
}
442
453
443
454
private function getComposerRootDir ($ rootDir )
0 commit comments