[DCOM-214] Collection Criteria isNull does not work well Created: 12/Sep/13  Updated: 12/Sep/13

Status: Open
Project: Doctrine Common
Component/s: Collections
Affects Version/s: 2.4.1
Fix Version/s: None
Security Level: All

Type: Bug Priority: Minor
Reporter: Jan Pecek Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: collection, criteria, expression

PHP 5.4.4, PostgreSQL 9.1


I'm using the Collection project https://github.com/doctrine/collections and its Criteria building part. I'm not sure if I'm putting this bug to the good project. Please, correct me if not.

There is bug in method isNull: https://github.com/doctrine/collections/blob/master/lib/Doctrine/Common/Collections/ExpressionBuilder.php#L125

This produces SQL command where is 'IS ?' and null value is passed as param. This is fail.

Code example:

  $expr = Criteria::expr();
  $criteria = Criteria::create()
	->where($expr->lte('num', 42))
  return $this->myCollection->matching($criteria);

This produces SQL:

 SELECT ... FROM ... WHERE num <= ? AND deleted IS ? 

with params

[ 42, null ]

Generated at Tue Nov 24 23:27:28 EST 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.