mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-04 15:57:45 +02:00
[ticket/17176] Clean up database code to prevent test issues
PHPBB3-17176
This commit is contained in:
@@ -1330,7 +1330,7 @@ abstract class driver implements driver_interface
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function clean_query_id(mixed $query_id): int|string
|
||||
public function clean_query_id(mixed $query_id): int|string|null
|
||||
{
|
||||
// Some DBMS functions accept/return objects and/or resources instead if identifiers
|
||||
// Attempting to use objects/resources as array keys will throw error, hence correctly handle all cases
|
||||
|
@@ -501,7 +501,7 @@ interface driver_interface
|
||||
*
|
||||
* @param mixed $query_id Mixed type query id
|
||||
*
|
||||
* @return int|string Query id in string or integer format
|
||||
* @return int|string|null Query id in string or integer format
|
||||
*/
|
||||
public function clean_query_id(mixed $query_id): int|string;
|
||||
public function clean_query_id(mixed $query_id): int|string|null;
|
||||
}
|
||||
|
@@ -478,7 +478,7 @@ class factory implements driver_interface
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function clean_query_id(mixed $query_id): int|string
|
||||
public function clean_query_id(mixed $query_id): int|string|null
|
||||
{
|
||||
return $this->get_driver()->clean_query_id($query_id);
|
||||
}
|
||||
|
@@ -436,7 +436,7 @@ class postgres extends \phpbb\db\driver\driver
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return @pg_close($this->db_connect_id);
|
||||
return pg_close($this->db_connect_id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -303,8 +303,9 @@ abstract class phpbb_database_test_case extends TestCase
|
||||
{
|
||||
$config = $this->get_database_config();
|
||||
|
||||
/** @var \phpbb\db\driver\driver_interface $db */
|
||||
$db = new $config['dbms']();
|
||||
$db->sql_connect($config['dbhost'], $config['dbuser'], $config['dbpasswd'], $config['dbname'], $config['dbport']);
|
||||
$db->sql_connect($config['dbhost'], $config['dbuser'], $config['dbpasswd'], $config['dbname'], $config['dbport'], false, true);
|
||||
|
||||
$this->db_connections[] = $db;
|
||||
|
||||
|
Reference in New Issue
Block a user