/
Integer field value validation inconsistency [5.2.2-B1]

Integer field value validation inconsistency [5.2.2-B1]

In In-Portal each field on a form has associated data type (e.g. "int", "float", "string", etc.) and upon form submit these actions are performed on each form field:

  1. convert value (in submit all values are strings) to data type matching field type (e.g. "string" to "int")
  2. confirm, that converted value is indeed of expected data type

This sound like a flawless approach, but internally the "settype" function is used for type conversion and instead here what happens:

Form ValueData TypeConverted ValueResult
text"int" or "float"0

FAILURE

5.2int5

FAILURE

5.2float5.2

SUCCESS

5.0float5

FAILURE

textstringtext

SUCCESS

As it becomes clear from above conversion table the "settype" function silently transforms value to match expected data type and it doesn't consider it as conversion failure, even when it technically is.

Solution

In "kFormatter::TypeCast" method, when value after calling "settype" method is changed (ignore fact, that data type is changed), then consider it as failed casing and return "false".

Related Discussions

Related Tasks

INP-1682 - Getting issue details... STATUS