Fixing setValue null value bug

On occasions when a form is submitted `StringTagField` throws an error saying `ERROR [Warning]: array_filter() expects parameter 1 to be array, null given` at the end of the `setValue` function. 

I have added some code that checks if `$value` is `null`. If it is `null` it sets `$value` to an empty array to prevent the error from occurring.
This commit is contained in:
3Dgoo 2015-11-23 12:27:59 +10:30
parent 96c48ab136
commit be0565c660

View File

@ -223,6 +223,10 @@ class StringTagField extends DropdownField
$value = $source->column('ID');
}
if (is_null($value)) {
$value = array();
}
return parent::setValue(array_filter($value));
}