View Issue Details

IDProjectCategoryView StatusLast Update
0007328mantisbtotherpublic2010-12-17 04:40
Reportermorganparry Assigned Todhx  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.3 
Target Version1.2.4Fixed in Version1.2.4 
Summary0007328: 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

Tagspatch
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;
 	}
ini_get_num_diff.txt (419 bytes)   

Activities

morganparry

morganparry

2006-08-14 09:44

reporter   ~0013264

Last edited: 2006-08-14 09:45

I've attached a fix in unified diff format. This is against Mantis v1.0.5.

dhx

dhx

2010-09-18 00:20

reporter   ~0026762

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.

Related Changesets

MantisBT: master e9599997

2010-09-18 00:10

dhx


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

dhx


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