mirror of
https://github.com/predis/predis.git
synced 2026-08-30 20:21:31 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user