Fix different behaviour of filter_var() with NULL on PHP 5.3.

Seriously, they could not possibly screw bool validation up any more
than they already had with filter_var().
This commit is contained in:
Daniele Alessandri
2013-11-08 15:31:14 +01:00
parent 9a72b98c4a
commit 1a769e3cc3
@@ -27,7 +27,8 @@ class ReplicationOption implements OptionInterface
* {@inheritdoc}
*
* @todo There's more code than needed due to a bug in filter_var()
* as discussed here https://bugs.php.net/bug.php?id=49510.
* as discussed here https://bugs.php.net/bug.php?id=49510
* and a different behaviour with NULL values on PHP 5.3.
*/
public function filter(OptionsInterface $options, $value)
{
@@ -35,7 +36,7 @@ class ReplicationOption implements OptionInterface
return $value;
}
if (is_bool($value)) {
if (is_bool($value) || $value === null) {
return $value ? $this->getDefault($options) : null;
}