Commit 75ac2f6c authored by Marco Pivetta's avatar Marco Pivetta

Merge branch...

Merge branch 'fix/#2500-#2497-return-false-from-mysqli-statement-when-nothing-is-fetched-2.5' into 2.5

Close #2500
Close #2497
parents f84b0c16 f1ccaed4
......@@ -242,7 +242,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
{
$values = $this->_fetch();
if (null === $values) {
return null;
return false;
}
if (false === $values) {
......@@ -282,7 +282,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
$rows[] = $row;
}
} else {
while (($row = $this->fetch($fetchMode)) !== null) {
while (($row = $this->fetch($fetchMode)) !== false) {
$rows[] = $row;
}
}
......@@ -296,7 +296,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
public function fetchColumn($columnIndex = 0)
{
$row = $this->fetch(PDO::FETCH_NUM);
if (null === $row) {
if (false === $row) {
return false;
}
......
......@@ -239,6 +239,13 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->assertEquals('foo', $row[1]);
}
public function testFetchNoResult()
{
self::assertFalse(
$this->_conn->executeQuery('SELECT test_int FROM fetch_table WHERE test_int = ?', [-1])->fetch()
);
}
public function testFetchAssoc()
{
$sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment