Fixed XF:Option default_value skips option_value type checking

Xon

Well-known member
Affected version
2.0.12
When setting a default value, the option_value type checking is not done on default_value

This allows invalid values to be set, as the option_value is populated directly by default_value when the option is insert on a new install.

Also, it would be nice if verifyOptionValue was more rigorous on what is a truthy value. While it is saved as 1/0, it accepts any truthy value which can lead to unexpected cases where a string/array default is cast silently to a boolean.
 
Last edited:
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.0 RC2).

Change log:
Add additional validation to option default values to ensure they are more fitting with the expected data type
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Just to expand on that message a bit, mostly this just means that we cast the default value like we cast option values. This still uses the "forced" approach that option values use.

The sub-option validation approach now matches the option value version (though default values did have some sub-option validation). We may throw a blocking error here, but we only do that if you're in development mode.
 
Back
Top Bottom