Enhancement for variables check

As mentioned in the comment, we should check allowed values first, because we may allow eg. "0" which is `empty` in PHP.