Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Zend\Db\ResultSet\ResultSet->current() returns false instead of NULL #330

@WillyBaldy

Description

@WillyBaldy

This problem was there in version 2.7. It was fixed in 2.8, but came back in 2.9.

  • Database: 10.0.35-MariaDB
  • PHP version: 7.2.7
  • Zend Db version: 2.9.3

To reproduce, use a database with some empty table, and execute:

$myAdapter = new \Zend\Db\Adapter\Adapter([
    'host'      => 'mariadb',
    'driver'    => 'Mysqli',
    'username'  => 'devppl',
    'password'  => '******',
    'database'  => 'mydatabase',
    'charset'   => 'utf8',
    'options'   => ['buffer_results' => true]
]);

$tableGateway = new \Zend\Db\TableGateway\TableGateway('myEmptyTable', $myAdapter);
$row = $tableGateway->select('myField = 999')->current();
var_export($row);

Expected result would be NULL, I get false instead.

I noticed that when I set buffer_results to false, I don't have the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions