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

Issue Type: Bug Created: 2011-12-02T21:19:31.000+0000 Last Updated: 2012-02-27T02:18:37.000+0000 Status: Resolved Fix version(s): - 1.11.12 (22/Jun/12)

Reporter: Franz de Leon (kelmadics) Assignee: Adam Lundrigan (adamlundrigan) Tags: - Zend_Db_Adapter_Mysqli

  • fetchRow
  • zend_db

Related issues: Attachments:


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 }


Posted by Adam Lundrigan (adamlundrigan) on 2012-02-27T02:13:40.000+0000

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

Posted by Adam Lundrigan (adamlundrigan) on 2012-02-27T02:18:37.000+0000

Fixed in trunk r24666 Merged to release-1.11 in r24667

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.