Use array_key_exists instead of isset()

This allows contains() to work with null values.

Fixes #4083