View Issue Details

IDProjectCategoryView StatusLast Update
0016133mantisbtcustom fieldspublic2017-10-28 19:08
ReporterpolzinAssigned 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
mod - core/custom_field_api.php Diff File

Issue History

Date Modified Username Field Change
2013-07-03 14:40 polzin New Issue
2013-07-03 15:34 atrol Status new => confirmed
2017-10-14 14:22 vboctor Assigned To => vboctor
2017-10-14 14:22 vboctor Status confirmed => assigned
2017-10-14 14:22 vboctor Product Version => 2.7.0
2017-10-14 14:22 vboctor Target Version => 2.8.0
2017-10-14 14:22 vboctor Note Added: 0057959
2017-10-22 13:19 vboctor Changeset attached => MantisBT master bc402539
2017-10-22 13:19 vboctor Status assigned => resolved
2017-10-22 13:19 vboctor Resolution open => fixed
2017-10-22 13:19 vboctor Fixed in Version => 2.8.0
2017-10-22 13:33 vboctor Summary Custom fields: No difference between "numeric" and "float" => Numeric field accepts floats and displays them as numeric
2017-10-28 19:08 vboctor Status resolved => closed