Skip to content

Commit

Permalink
Fix Hash::_mathces miss comparison 0 with string-value
Browse files Browse the repository at this point in the history
  • Loading branch information
o0h committed Feb 5, 2018
1 parent 1dd631b commit e70013f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Utility/Hash.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,17 @@ protected static function _matches($data, $selector)
$prop = $prop ? '1' : '0';
} elseif ($isBool) {
$prop = $prop ? 'true' : 'false';
} elseif (is_numeric($prop)) {
$prop = (string)$prop;
}

// Pattern matches and other operators.
if ($op === '=' && $val && $val[0] === '/') {
if (!preg_match($val, $prop)) {
return false;
}
} elseif (($op === '=' && $prop != $val) ||
($op === '!=' && $prop == $val) ||
} elseif (($op === '=' && $prop !== $val) ||
($op === '!=' && $prop === $val) ||
($op === '>' && $prop <= $val) ||
($op === '<' && $prop >= $val) ||
($op === '>=' && $prop < $val) ||
Expand Down

0 comments on commit e70013f

Please sign in to comment.