Browse Source

Fix Hash::_mathces miss comparison 0 with string-value

Hideki Kinjyo 8 years ago
parent
commit
e70013f291
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/Utility/Hash.php

+ 4 - 2
src/Utility/Hash.php

@@ -267,6 +267,8 @@ class Hash
                 $prop = $prop ? '1' : '0';
             } elseif ($isBool) {
                 $prop = $prop ? 'true' : 'false';
+            } elseif (is_numeric($prop)) {
+                $prop = (string)$prop;
             }
 
             // Pattern matches and other operators.
@@ -274,8 +276,8 @@ class Hash
                 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) ||