Adding null value checks to Set::diff()

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4499 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2007-02-10 17:19:49 +00:00
parent 6331a6d4c4
commit 4fb52738d3

View file

@ -261,6 +261,11 @@ class Set extends Object {
} }
$out = array(); $out = array();
if (empty($val1)) {
return (array)$val2;
} elseif (empty($val2)) {
return (array)$val1;
}
foreach ($val1 as $key => $val) { foreach ($val1 as $key => $val) {
if (!isset($val2[$key]) || $val2[$key] != $val) { if (!isset($val2[$key]) || $val2[$key] != $val) {
$out[$key] = $val; $out[$key] = $val;