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

Issue Type: Bug Created: 2010-10-22T08:39:49.000+0000 Last Updated: 2010-11-20T09:12:52.000+0000 Status: Resolved Fix version(s): - 1.11.0 (02/Nov/10)

Reporter: Simon Gilliot (alsimon) Assignee: Ralph Schindler (ralph) Tags: - Zend_Db_Select

Related issues: Attachments: - ZF-10589.patch


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); 


Posted by Marc Hodgins (mjh_ca) on 2010-10-24T17:09:48.000+0000

Patch with unit test attached.

Posted by Ralph Schindler (ralph) on 2010-10-25T13:15:48.000+0000

Fixed in r23236 in trunk and r23237 in release branch 1.11

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.