[4.2] Fix A Bug That Validator Bypasses Array Checking

For checking array with “sometimes”
Validator calls function passesOptionalCheck to check if attribute key is set.
“passesOptionalCheck” uses array_dot to flatten the input data, so for input like “items”: [“good1”, “good2”, “good3”] become array(“items.0”
=> “good1”, “items.1” => “good2”, “items.2” => “good3”). Checking attribute with array_key_exists here will always return false and
validation is skipped