diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php index 61a2044040..52e8545f36 100644 --- a/phpBB/phpbb/db/driver/driver.php +++ b/phpBB/phpbb/db/driver/driver.php @@ -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 diff --git a/phpBB/phpbb/db/driver/driver_interface.php b/phpBB/phpbb/db/driver/driver_interface.php index 0f90f5fdeb..918add2e62 100644 --- a/phpBB/phpbb/db/driver/driver_interface.php +++ b/phpBB/phpbb/db/driver/driver_interface.php @@ -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; } diff --git a/phpBB/phpbb/db/driver/factory.php b/phpBB/phpbb/db/driver/factory.php index 4aaf52902d..4d28ab1032 100644 --- a/phpBB/phpbb/db/driver/factory.php +++ b/phpBB/phpbb/db/driver/factory.php @@ -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); } diff --git a/phpBB/phpbb/db/driver/postgres.php b/phpBB/phpbb/db/driver/postgres.php index 31137634fe..1f695acb83 100644 --- a/phpBB/phpbb/db/driver/postgres.php +++ b/phpBB/phpbb/db/driver/postgres.php @@ -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); } /** diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index e8d5a653a6..0c0317fe10 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -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;