mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Merge remote-tracking branch 'igorw/ticket/10307' into develop-olympus
* igorw/ticket/10307: [ticket/10307] Add a test for PHPBB3-10307 [ticket/10307] Return false in mysqli sql_fetchrow on empty result
This commit is contained in:
commit
4e69fe6859
2 changed files with 24 additions and 2 deletions
|
@ -249,7 +249,13 @@ class dbal_mysqli extends dbal
|
|||
return $cache->sql_fetchrow($query_id);
|
||||
}
|
||||
|
||||
return ($query_id !== false) ? @mysqli_fetch_assoc($query_id) : false;
|
||||
if ($query_id !== false)
|
||||
{
|
||||
$result = @mysqli_fetch_assoc($query_id);
|
||||
return $result !== null ? $result : false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -319,7 +319,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case
|
|||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
function test_nested_transactions()
|
||||
public function test_nested_transactions()
|
||||
{
|
||||
$db = $this->new_dbal();
|
||||
|
||||
|
@ -341,4 +341,20 @@ class phpbb_dbal_select_test extends phpbb_database_test_case
|
|||
|
||||
$this->assertEquals('1', $row['user_id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* fix for PHPBB3-10307
|
||||
*/
|
||||
public function test_sql_fetchrow_returns_false_when_empty()
|
||||
{
|
||||
$db = $this->new_dbal();
|
||||
|
||||
$sql = 'SELECT * FROM (SELECT 1) AS TBL WHERE 1 = 0';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$this->assertSame(false, $row);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue