Permalink
Browse files

BUG Fix to prevent unintended results from getComponentsQuery(...)

Wrapped $filter inside parentheses to prevent unintended results if $filter contains "OR".
  • Loading branch information...
1 parent 33b9b18 commit 8ec6312f3f21de4f4eb1c2f0ec5e15e6ff43d4fe @stozze stozze committed with stozze Sep 14, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 core/model/DataObject.php
@@ -1307,7 +1307,7 @@ public function getComponentsQuery($componentName, $filter = "", $sort = "", $jo
// get filter
$combinedFilter = "\"$joinField\" = '$id'";
- if($filter) $combinedFilter .= " AND {$filter}";
+ if(!empty($filter)) $combinedFilter .= " AND ({$filter})";
return singleton($componentClass)->extendedSQL($combinedFilter, $sort, $limit, $join);
}

0 comments on commit 8ec6312

Please sign in to comment.