View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0007328 | mantisbt | other | public | 2006-08-03 05:43 | 2010-12-17 04:40 |
| Reporter | morganparry | Assigned To | dhx | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Product Version | 1.2.3 | ||||
| Target Version | 1.2.4 | Fixed in Version | 1.2.4 | ||
| Summary | 0007328: ini_get_number() interprets K and M suffixes incorrectly | ||||
| Description | This function incorrectly interprets K as 1000 and M as 1000000. I think that should be 1024 and 1048576 respectively. See, for example, http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes | ||||
| Tags | patch | ||||
| Attached Files | ini_get_num_diff.txt (419 bytes)
==== core/utility_api.php#2 (text) ====
@@ -159,11 +159,11 @@
$t_result = ini_get( $p_name );
$t_val = spliti( 'M', $t_result);
if ( $t_val[0] != $t_result ) {
- return $t_val[0] * 1000000;
+ return $t_val[0] * 1024 * 1024;
}
$t_val = spliti( 'K', $t_result);
if ( $t_val[0] != $t_result ) {
- return $t_val[0] * 1000;
+ return $t_val[0] * 1024;
}
return $t_result;
}
| ||||
|
I've attached a fix in unified diff format. This is against Mantis v1.0.5. |
|
|
Only 4 years turnaround time on this issue... not bad :P It should finally be fixed now. Thanks Morgan (if you're still listening in to your email address of 4 years ago)! And thanks Roland for triaging and bumping up old bugs like this one. |
|
|
MantisBT: master e9599997 2010-09-18 00:10 Details Diff |
Fix 0007328: ini_get_number uses wrong postfix multipliers The ini_get_number function currently uses the wrong postfix multipliers when determining the integer value of configuration options from php.ini. The PHP manual clearly states that k = kibibyte instead of k = kilobyte as per http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes Thus we need to change the postfix multipliers to reflect what the PHP manual defines for php.ini. Thanks to Morgan Parry for providing a patch to this issue just over 4 years ago. And thanks to Roland Becker for bumping up old issues like this one that have been forgotten in the past. |
Affected Issues 0007328 |
|
| mod - core/utility_api.php | Diff File | ||
|
MantisBT: master-1.2.x 3536e18a 2010-09-18 00:10 Details Diff |
Fix 0007328: ini_get_number uses wrong postfix multipliers The ini_get_number function currently uses the wrong postfix multipliers when determining the integer value of configuration options from php.ini. The PHP manual clearly states that k = kibibyte instead of k = kilobyte as per http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes Thus we need to change the postfix multipliers to reflect what the PHP manual defines for php.ini. Thanks to Morgan Parry for providing a patch to this issue just over 4 years ago. And thanks to Roland Becker for bumping up old issues like this one that have been forgotten in the past. |
Affected Issues 0007328 |
|
| mod - core/utility_api.php | Diff File | ||