Index: lib/Doctrine/Query/Abstract.php =================================================================== --- lib/Doctrine/Query/Abstract.php (revision 7676) +++ lib/Doctrine/Query/Abstract.php (working copy) @@ -1359,16 +1359,14 @@ */ public function andWhereIn($expr, $params = array(), $not = false) { - // if there's no params, return (else we'll get a WHERE IN (), invalid SQL) - if (isset($params) and (count($params) == 0)) { - return $this; - } + // (the following statement will throw exception if there's no params) + $whereIn = $this->_processWhereIn($expr, $params, $not); if ($this->_hasDqlQueryPart('where')) { $this->_addDqlQueryPart('where', 'AND', true); } - return $this->_addDqlQueryPart('where', $this->_processWhereIn($expr, $params, $not), true); + return $this->_addDqlQueryPart('where', $whereIn, true); } /** @@ -1386,16 +1384,14 @@ */ public function orWhereIn($expr, $params = array(), $not = false) { - // if there's no params, return (else we'll get a WHERE IN (), invalid SQL) - if (isset($params) and (count($params) == 0)) { - return $this; - } + // (the following statement will throw exception if there's no params) + $whereIn = $this->_processWhereIn($expr, $params, $not); if ($this->_hasDqlQueryPart('where')) { $this->_addDqlQueryPart('where', 'OR', true); } - return $this->_addDqlQueryPart('where', $this->_processWhereIn($expr, $params, $not), true); + return $this->_addDqlQueryPart('where', $whereIn, true); } /** @@ -1405,7 +1401,7 @@ { $params = (array) $params; - // if there's no params, return (else we'll get a WHERE IN (), invalid SQL) + // if there's no params, throw exception (else we'll get a WHERE IN (), invalid SQL) if (count($params) == 0) { throw new Doctrine_Query_Exception('You must pass at least one parameter when using an IN() condition.'); }