[wp-trac] [WordPress Trac] #14889: Memory Comparison Broken / WordPress Memory Limit
WordPress Trac
wp-trac at lists.automattic.com
Fri Sep 17 11:46:25 UTC 2010
#14889: Memory Comparison Broken / WordPress Memory Limit
--------------------------+-------------------------------------------------
Reporter: hakre | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords: has-patch
--------------------------+-------------------------------------------------
Comment(by hakre):
Patch is based on a code example how to convert the values to numeric
values (numeric values that can be compared to each other) from the PHP
Manual:
{{{
function return_bytes($val) {
$val = trim($val);
$last = strtolower($val[strlen($val)-1]);
switch($last) {
// The 'G' modifier is available since PHP 5.1.0
case 'g':
$val *= 1024;
case 'm':
$val *= 1024;
case 'k':
$val *= 1024;
}
return $val;
}
}}}
Source: http://www.php.net/manual/en/function.ini-get.php
I modified it to reflect to return an integervalue larger then -1. MAX_INT
might conflict with memory settings (e.g. on 32 bit systems, needs
verififcation), so (int) might not be appropriate and need to be replaced
with (float). ( Related: #10332 )
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14889#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list