diff --git a/phpBB/phpbb/db/driver/postgres.php b/phpBB/phpbb/db/driver/postgres.php index 1f695acb83..0289901ea9 100644 --- a/phpBB/phpbb/db/driver/postgres.php +++ b/phpBB/phpbb/db/driver/postgres.php @@ -431,8 +431,8 @@ class postgres extends \phpbb\db\driver\driver */ protected function _sql_close(): bool { - // Released resources are already closed, return true in this case - if (!$this->db_connect_id instanceof \PgSql\Connection) + // Skip if connection is already closed or not persistent + if (!$this->persistency || !$this->db_connect_id instanceof \PgSql\Connection) { return true; } diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index 0c0317fe10..98626865b0 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -305,7 +305,7 @@ abstract class phpbb_database_test_case extends TestCase /** @var \phpbb\db\driver\driver_interface $db */ $db = new $config['dbms'](); - $db->sql_connect($config['dbhost'], $config['dbuser'], $config['dbpasswd'], $config['dbname'], $config['dbport'], false, true); + $db->sql_connect($config['dbhost'], $config['dbuser'], $config['dbpasswd'], $config['dbname'], $config['dbport']); $this->db_connections[] = $db;