Input filter should filter values before checking empty/required status

Fixes https://github.com/zendframework/zf2/issues/6668

All the unit tests pass without any modifications, hoever this patch may introduce some BC breaks. Would be good to have several people review this to make sure the logic is sound.