Merge branch '0.9'

This commit is contained in:
Henrique Moody 2015-05-28 11:32:58 -03:00
commit 2c2c838c1a
2 changed files with 10 additions and 1 deletions

View file

@ -5,6 +5,11 @@ class Json extends AbstractRule
{
public function validate($input)
{
return (bool) (json_decode($input));
if (is_string($input)
&& strtolower($input) == 'null') {
return true;
}
return (null !== json_decode($input));
}
}

View file

@ -38,6 +38,10 @@ class JsonTest extends \PHPUnit_Framework_TestCase
array('[1,2,3]'),
array('["foo", "bar", "number", 1]'),
array('{"foo": "bar", "number":1}'),
array('[]'),
array('{}'),
array('false'),
array('null'),
);
}