View Issue Details

IDProjectCategoryView StatusLast Update
0016133mantisbtcustom fieldspublic2017-10-28 19:08
Reporterpolzin Assigned Tovboctor  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.7.0 
Target Version2.8.0Fixed in Version2.8.0 
Summary0016133: Numeric field accepts floats and displays them as numeric
Description

Interestingly, for php floats are numeric. As a consequence, there is no difference between custom fields of type "numeric" and "float". The mantis-docs say, "numeric" means "is an integer", but any numeric value may be accepted.

A correct test for integer-strings is described here:
http://stackoverflow.com/questions/3502854/is-int-and-get-or-post

For "floats" is_numeric() is sufficient, although it allows "4e1" and "0x123". Therefore, a better solution would be valuable here, too.

Workaround: Use a string with regexps. :-/

Additional Information

https://github.com/mantisbt/mantisbt/blob/master-1.2.x/core/custom_field_api.php#L1054

http://php.net/manual/de/function.is-numeric.php

TagsNo tags attached.

Activities

Related Changesets

MantisBT: master bc402539

2017-10-14 14:20:59

vboctor

Details Diff
Numeric fields shouldn’t accept floats

Fixes 0016133
Affected Issues
0016133
mod - core/custom_field_api.php Diff File