diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 2598524..edf6510 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -3435,5 +3435,5 @@ function drupal_check_memory_limit($required, $memory_limit = NULL) { // - No memory limit is set. // - The memory limit is set to unlimited (-1). // - The memory limit is greater than the memory required for the operation. - return ((!$memory_limit) || ($memory_limit == -1) || (parse_size($memory_limit) > parse_size($required))); + return ((!$memory_limit) || ($memory_limit == -1) || (parse_size($memory_limit) >= parse_size($required))); } diff --git a/modules/simpletest/tests/bootstrap.test b/modules/simpletest/tests/bootstrap.test index 813dba9..78f0475 100644 --- a/modules/simpletest/tests/bootstrap.test +++ b/modules/simpletest/tests/bootstrap.test @@ -471,7 +471,6 @@ class BootstrapMiscTestCase extends DrupalUnitTestCase { // Get the available memory and multiply it by two to make it unreasonably // high. $twice_avail_memory = ($memory_limit * 2) . 'MB'; - $this->assertFalse(drupal_check_memory_limit($twice_avail_memory), 'drupal_check_memory_limit() returns FALSE for twice the available memory limit.'); // The function should always return true if the memory limit is set to -1. $this->assertTrue(drupal_check_memory_limit($twice_avail_memory, -1), 'drupal_check_memory_limit() returns TRUE when a limit of -1 (none) is supplied'); @@ -479,6 +478,9 @@ class BootstrapMiscTestCase extends DrupalUnitTestCase { // Test that even though we have 30MB of memory available - the function // returns FALSE when given an upper limit for how much memory can be used. $this->assertFalse(drupal_check_memory_limit('30MB', '16MB'), 'drupal_check_memory_limit() returns FALSE with a 16MB upper limit on a 30MB requirement.'); + + // Test that an equal amount of memory to the amount requested returns TRUE. + $this->assertTrue(drupal_check_memory_limit('30MB', '30MB'), 'drupal_check_memory_limit() returns TRUE when requesting 30MB on a 30MB requirement.'); } } diff --git a/modules/system/system.install b/modules/system/system.install index ec51bcf..1b037b8 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -208,7 +208,7 @@ function system_requirements($phase) { 'value' => $memory_limit == -1 ? t('-1 (Unlimited)') : $memory_limit, ); - if (!drupal_check_memory_limit(DRUPAL_MINIMUM_PHP_MEMORY_LIMIT, $memory_limit)) { + if ($memory_limit && $memory_limit != -1 && parse_size($memory_limit) < parse_size(DRUPAL_MINIMUM_PHP_MEMORY_LIMIT)) { $description = ''; if ($phase == 'install') { $description = $t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the installation process.', array('%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT));