ZF-11923: Zend_Db_Adapter::fetchRow is returning a BOOLEAN false on empty query

Description

when i was fetching a single row using Zend_Db_Adapter::fetchRow() I was expecting that if I was retrieving an SQL with no result that I would get an empty ARRAY but instead i am getting a boolean FALSE.

The document/annotation is stating that it SHOULD return an array:

739 /** 740 * Fetches the first row of the SQL result. 741 * Uses the current fetchMode for the adapter. 742 * 743 * @param string|Zend_Db_Select $sql An SQL SELECT statement. 744 * @param mixed $bind Data to bind into SELECT placeholders. 745 * @param mixed $fetchMode Override current fetch mode. 746 * @return array 747 */ 748 public function fetchRow($sql, $bind = array(), $fetchMode = null) 749 { 750 if ($fetchMode === null) { 751 $fetchMode = $this->_fetchMode; 752 } 753 $stmt = $this->query($sql, $bind); 754 $result = $stmt->fetch($fetchMode); 755 return $result; 756 }

Comments

There are many of these types of errors in the docblocks of Zend Framework. According to the manual page {{Zend_Db_Statement::fetch}} should return FALSE if no records are found, so {{Zend_Db_Adapter::fetchRow}} is functioning as intended.

For this case I will correct the docblock

Fixed in trunk r24666 Merged to release-1.11 in r24667