ZF-10589: Zend_Db_Select::having() and Zend_Db_Select::orHaving() with empty "$value" param ("0" or an "empty string")


Hi All,

Ticket #10000 on the bug tracker has added a functionality and was committed on release r22850.

It changes Zend_Db_Select::having() method and Zend_Db_Select::orHaving() method in Zend_Db_Select to allow us to pass the optional second parameter which way the $value should be quoted.

The patch was :

  • if (func_num_args()> 1) {
  • $val = func_get_arg(1);
  • $cond = $this->_adapter->quoteInto($cond, $val);
  • if ($value) {
  • $cond = $this->_adapter->quoteInto($cond, $value, $type); }

My problem is that i can't pass a value which is considered as false (0, an empty string) in the statement. So i can't do :

$select->having("foo = ?", 0); 


$select->orHaving("foo = ?", 0); 


Patch with unit test attached.

Fixed in r23236 in trunk and r23237 in release branch 1.11