1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-17 22:28:46 +01:00

[ticket/16740] Improve open queries handling & do not close freed connection

PHPBB3-16740
This commit is contained in:
Marc Alexander 2021-03-28 09:52:55 +02:00
parent 03824189e4
commit c99bfe116f
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995
2 changed files with 8 additions and 3 deletions

View File

@ -386,9 +386,9 @@ class postgres extends \phpbb\db\driver\driver
return $cache->sql_freeresult($safe_query_id);
}
if (isset($this->open_queries[(int) $safe_query_id]))
if (isset($this->open_queries[$safe_query_id]))
{
unset($this->open_queries[(int) $safe_query_id]);
unset($this->open_queries[$safe_query_id]);
return pg_free_result($query_id);
}
@ -466,6 +466,11 @@ class postgres extends \phpbb\db\driver\driver
*/
function _sql_close()
{
// Released resources are already closed, return true in this case
if (get_resource_type($this->db_connect_id) === 'Unknown')
{
return true;
}
return @pg_close($this->db_connect_id);
}

View File

@ -29,7 +29,7 @@ abstract class phpbb_database_test_case extends TestCase
static protected $install_schema_file;
static protected $phpunit_version;
static protected $phpunit_version;
public function __construct($name = NULL, array $data = [], $dataName = '')
{