Internal note: This looks actual bug, the code above check if $function is an array and iterate over it validating each value and appending to the functions field