From a2d21fd739a723901466fee1167e899e1c142acb Mon Sep 17 00:00:00 2001 From: webchick Date: Thu, 28 Jul 2011 17:40:33 -0400 Subject: Issue #123983 by TR, klavs: Fixed PHP memory not allowing color scheme change. --- modules/color/color.module | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'modules') 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 PHP documentation for more information.', array('%size' => format_size($usage + $required - $limit), '@url' => 'http://www.php.net/manual/ini.core.php#ini.sect.resource-limits')), 'error'); -- cgit v1.2.3