ZF2-429: DBTable Adapter - Row count is not available in unbuffered result sets.


Using DBTable Adapter as Adapter for AuthenticationService throws exception on authenticate

Bug exists at line 418, _authenticateQuerySelect() method;

$resultSet->initialize($statement->execute(array($this->_credential, $this->_identity)));
$resultIdentities = $resultSet->toArray();

Fix: Call buffer method in Zend\DB\ResultSet\AbstractResultSet in initialize method below line 52:

if ($dataSource instanceof ResultInterface) {
      $this->count = $dataSource->count();
      $this->fieldCount = $dataSource->getFieldCount();
      $this->dataSource = $dataSource;
      return $this;


You can send the patch following this instructions


I'm not able to reproduce this problem. Do you have a test case that can reproduce the issue?

Which DB Connection type are you using?

This is not happening in pdo adapter. Only in mysqli. I didn't know that there is an option in mysqli adapter for auto buffering resultsets.

This is a config for auto buffering.

$dbconfig = array( 'driver' => 'Mysqli', 'hostname' => 'localhost', 'username' => 'developer', 'password' => 'developer', 'database' => 'zend_db_example', 'options' => array('buffer_results' => true) );