Fix boolean validator and add test cases

The filter_var function for boolean only works with non true boolean
values. Therefore first check if the value to be validated is a true
boolean and do not use filter_var in that case.