• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Won't fix  Inconsistent usage of explicit default value in XenForo_Input

Shadab

Well-known member
#1
If I understand correctly, the "default" value is used when the input data is not of the expected data type or cannot be coerced into the expected data type. And the default value of numeric data types is zero, unless explicitly specified in the "Filter Options" array.

Here's a quick test I did, using the XenForo_Input::UINT filter...

filtering_unsigned_integers.png

The values highlighted should be 16 (passed explicitly using the filter options) instead of 0.
This is the same behavior with all the numeric data types:
  • XenForo_Input::NUM
  • XenForo_Input::UNUM
  • XenForo_Input::INT
  • XenForo_Input::UINT
  • XenForo_Input::FLOAT
 

Mike

XenForo developer
Staff member
#2
The primary use of the default value is if the value isn't provided in the output. I'm not exactly keen on changing this for cases where incorrectly formatted values are passed - right now it just does the simplest thing: casts to the correct type.