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

Lack of interest Some suggestions for XenForo_DataWriter::_applyFieldValueLimits

R

ragtek

Guest
#1
It would be really nice and useful if there would be a better errormessage in the method, instead of only returning the please_enter_valid_value phrase, which makes debugging without an real debugger a pain:p


My quick and dirty fix:
I've added $fieldName as additional paramter to _applyFieldValueLimits and changed

PHP:
if (isset($extraLimits['allowedValues']) && is_array($extraLimits['allowedValues']) && !in_array($value, $extraLimits['allowedValues']))
{
return new XenForo_Phrase('please_enter_valid_value');
}
to
PHP:
if (isset($extraLimits['allowedValues']) && is_array($extraLimits['allowedValues']) && !in_array($value, $extraLimits['allowedValues']))
{
return new XenForo_Phrase('please_enter_valid_value') . ' for ' .get_called_class() .' field ' . $fieldName;
}
now it's returning



Error
Please enter a valid value. for field blog_type

instead of

Error
Please enter a valid value.

Which makes debugging A LOT EASIER!
 

HWS

Well-known member
#2
YES, please. I support this. I also wrote a quick fix to solve this issue and spare much time debugging issues.