Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9c71d4f

Browse files
committedDec 7, 2011
Fix #12029 : minimum length of custom fields of type numeric is not checked
1 parent 8fb27ae commit 9c71d4f

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
@@ -1158,10 +1158,20 @@ function custom_field_validate( $p_field_id, $p_value ) {
11581158
break;
11591159
case CUSTOM_FIELD_TYPE_NUMERIC:
11601160
$t_valid &= ( $t_length == 0 ) || is_numeric( $p_value );
1161+
1162+
# Check the length of the number
1163+
$t_valid &= ( 0 == $t_length_min ) || ( $t_length >= $t_length_min );
1164+
$t_valid &= ( 0 == $t_length_max ) || ( $t_length <= $t_length_max );
1165+
11611166
break;
11621167
case CUSTOM_FIELD_TYPE_FLOAT:
11631168
# Allow both integer and float numbers
11641169
$t_valid &= ( $t_length == 0 ) || is_numeric( $p_value ) || is_float( $p_value );
1170+
1171+
# Check the length of the number
1172+
$t_valid &= ( 0 == $t_length_min ) || ( $t_length >= $t_length_min );
1173+
$t_valid &= ( 0 == $t_length_max ) || ( $t_length <= $t_length_max );
1174+
11651175
break;
11661176
case CUSTOM_FIELD_TYPE_DATE:
11671177
# gpc_get_cf for date returns the value from strftime

0 commit comments

Comments
 (0)
Please sign in to comment.