summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2011-07-28 17:40:33 -0400
committerwebchick <webchick@24967.no-reply.drupal.org>2011-07-28 17:40:33 -0400
commita2d21fd739a723901466fee1167e899e1c142acb (patch)
treee5048a0f372a6b5a183abfc9343d9abdb0ca8a9a
parent91c37eaaeb0af841f5adc1018cbedfe7d2e9b89d (diff)
downloadbrdo-a2d21fd739a723901466fee1167e899e1c142acb.tar.gz
brdo-a2d21fd739a723901466fee1167e899e1c142acb.tar.bz2
Issue #123983 by TR, klavs: Fixed PHP memory not allowing color scheme change.
-rw-r--r--modules/color/color.module6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/color/color.module b/modules/color/color.module
index fbc00f139..d87b12f78 100644
--- a/modules/color/color.module
+++ b/modules/color/color.module
@@ -314,7 +314,11 @@ function color_scheme_form_submit($form, &$form_state) {
// We need at least a copy of the source and a target buffer of the same
// size (both at 32bpp).
$required = $width * $height * 8;
- $usage = memory_get_usage();
+ // We intend to prevent color scheme changes if there isn't enought memory
+ // available. memory_get_usage(TRUE) returns a more accurate number than
+ // memory_get_usage(), therefore we won't inadvertently reject a color
+ // scheme change based on a faulty memory calculation.
+ $usage = memory_get_usage(TRUE);
$limit = parse_size(ini_get('memory_limit'));
if ($usage + $required > $limit) {
drupal_set_message(t('There is not enough memory available to PHP to change this theme\'s color scheme. You need at least %size more. Check the <a href="@url">PHP documentation</a> for more information.', array('%size' => format_size($usage + $required - $limit), '@url' => 'http://www.php.net/manual/ini.core.php#ini.sect.resource-limits')), 'error');