Skip to content

Commit dd286bf

Browse files
committedDec 7, 2011
Fix #12029 : minimum length of custom fields of type numeric is not checked
1 parent 170e939 commit dd286bf

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
 

‎core/custom_field_api.php

+10
Original file line numberDiff line numberDiff line change
@@ -1171,10 +1171,20 @@ function custom_field_validate( $p_field_id, $p_value ) {
11711171
break;
11721172
case CUSTOM_FIELD_TYPE_NUMERIC:
11731173
$t_valid &= ( $t_length == 0 ) || is_numeric( $p_value );
1174+
1175+
# Check the length of the number
1176+
$t_valid &= ( 0 == $t_length_min ) || ( $t_length >= $t_length_min );
1177+
$t_valid &= ( 0 == $t_length_max ) || ( $t_length <= $t_length_max );
1178+
11741179
break;
11751180
case CUSTOM_FIELD_TYPE_FLOAT:
11761181
# Allow both integer and float numbers
11771182
$t_valid &= ( $t_length == 0 ) || is_numeric( $p_value ) || is_float( $p_value );
1183+
1184+
# Check the length of the number
1185+
$t_valid &= ( 0 == $t_length_min ) || ( $t_length >= $t_length_min );
1186+
$t_valid &= ( 0 == $t_length_max ) || ( $t_length <= $t_length_max );
1187+
11781188
break;
11791189
case CUSTOM_FIELD_TYPE_DATE:
11801190
# gpc_get_cf for date returns the value from strftime

0 commit comments

Comments
 (0)
Please sign in to comment.