View Issue Details

IDProjectCategoryView StatusLast Update
0010476mantisbtcustom fieldspublic2010-02-22 14:34
ReporterStriker Assigned Todhx  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.1.7 
Target Version1.2.0Fixed in Version1.2.0 
Summary0010476: Logic incorrect for minimum length on custom string field
Description

The following logic currently exists in both 1.1.7 and git (line 1172), function custom_field_validate:

$t_valid &= ( 0 == $t_length_min ) || ( $t_length > $t_length_min );

This the use of ">" causes submitted reports to fail if the amount of characters equals the minimum. The line should instead be:

$t_valid &= ( 0 == $t_length_min ) || ( $t_length >= $t_length_min );

Steps To Reproduce
  • Create custom string field for a project
  • Set min and max to same value
  • Try to submit a bug
  • No values will accepted
Additional Information

http://git.mantisbt.org/?p=mantisbt.git;a=blob;f=core/custom_field_api.php;h=0aecf70243644a1168c4e5cf5b008608555d2a48#l1172

TagsNo tags attached.
Attached Files
custom_field_api.php.patch (632 bytes)   
diff -rupN HEAD/core/custom_field_api.php PATCH/core/custom_field_api.php
--- HEAD/core/custom_field_api.php	2009-08-02 11:31:38.000000000 -0500
+++ PATCH/core/custom_field_api.php	2009-08-02 11:32:40.000000000 -0500
@@ -1164,7 +1164,7 @@ function custom_field_validate( $p_field
 				$t_valid &= ereg( $t_valid_regexp, $p_value );
 			}
 			// check string length
-			$t_valid &= ( 0 == $t_length_min ) || ( $t_length > $t_length_min );
+			$t_valid &= ( 0 == $t_length_min ) || ( $t_length >= $t_length_min );
 			$t_valid &= ( 0 == $t_length_max ) || ( $t_length <= $t_length_max );
 			break;
 		case CUSTOM_FIELD_TYPE_NUMERIC:
custom_field_api.php.patch (632 bytes)   

Activities

dhx

dhx

2009-10-28 20:49

reporter   ~0023457

Thanks for the patch! I've committed it to the 1.2.x and 1.3.x branches.

Related Changesets

MantisBT: master-1.2.x dc9b8b14

2009-10-28 20:47

dhx


Details Diff
Fix 0010476: Logic incorrect for minimum length of custom field string

A string which is equal in length to the minimum allowed should be
accepted. Thanks to Striker for this patch.
Affected Issues
0010476
mod - core/custom_field_api.php Diff File

MantisBT: master 7ab8078b

2009-10-28 20:47

dhx


Details Diff
Fix 0010476: Logic incorrect for minimum length of custom field string

A string which is equal in length to the minimum allowed should be
accepted. Thanks to Striker for this patch.
Affected Issues
0010476
mod - core/custom_field_api.php Diff File