UnionOfRAD/lithium — pull request #227 by joebeeson (2011-12-30 01:35:55+00:00)
Title: Changing Validator::check to correctly handle NULL values

I was receiving a `Validator` test failure in 31c2945eac5787cc32f0ef63edafdb1fcacb8201. The failure is described below:

> Assertion 'assertTrue' failed in lithium\tests\cases\util\ValidatorTest::testCheckSkipEmpty() on line 972

...and from the code test, only slightly modified for brevity's sake...

```php
$rules = array(
'email' => array('email', 'skipEmpty' => true, 'message' => 'email is not valid')
);

// null value should pass
$data = array('email' => null);
$result = Validator::check($data, $rules);
$this->assertTrue(empty($result));
```

The `Validator` uses `isset` to check if the array has the field available, thing is that PHP ignores `NULL` values and says it doesn't exist. This change simply changes the check to `array_key_exists` which works as expected.