Skip to content

Commit

Permalink
Fix #72.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Nov 14, 2006
1 parent 8dc2ecd commit de9052e
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions PHPUnit/Framework/Constraint/IsEqual.php
Expand Up @@ -176,15 +176,8 @@ protected function recursiveComparison($a, $b, $depth = 0)
return TRUE; return TRUE;
} }


// Normal comparision for scalar values. if (is_array($a) XOR is_array($b)) {
if ((!is_array($a) && !is_object($a)) || return FALSE;
(!is_array($b) && !is_object($b))) {
if (is_numeric($a) && is_numeric($b)) {
// Optionally apply delta on numeric values.
return $this->numericComparison($a, $b);
} else {
return ($a == $b);
}
} }


if (is_object($a) XOR is_object($b)) { if (is_object($a) XOR is_object($b)) {
Expand All @@ -196,6 +189,17 @@ protected function recursiveComparison($a, $b, $depth = 0)
return FALSE; return FALSE;
} }


// Normal comparision for scalar values.
if ((!is_array($a) && !is_object($a)) ||
(!is_array($b) && !is_object($b))) {
if (is_numeric($a) && is_numeric($b)) {
// Optionally apply delta on numeric values.
return $this->numericComparison($a, $b);
} else {
return ($a == $b);
}
}

if (is_object($a)) { if (is_object($a)) {
$a = (array) $a; $a = (array) $a;
$b = (array) $b; $b = (array) $b;
Expand Down

0 comments on commit de9052e

Please sign in to comment.