From 970848409d40040b3fdc07f45183935f7419b527 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 6 Apr 2010 17:56:54 +0200 Subject: [ticket/9518] Correctly create new connection on PostgreSQL when new connection is forced. pg_connect() takes an integer as the second parameter, but we were passing a boolean parameter. The function especially requires passing the PGSQL_CONNECT_FORCE_NEW constant if a new connection is to be forced. Passing 0 as the second parameter for 'do not force a new connection' doesn't work as expected, hence we're calling the function without a second parameter in this case. PHPBB3-9518 --- phpBB/includes/db/postgres.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/db/postgres.php') diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php index d117e8c948..b3139b3d79 100644 --- a/phpBB/includes/db/postgres.php +++ b/phpBB/includes/db/postgres.php @@ -76,7 +76,14 @@ class dbal_postgres extends dbal $this->persistency = $persistency; - $this->db_connect_id = ($this->persistency) ? @pg_pconnect($connect_string, $new_link) : @pg_connect($connect_string, $new_link); + if ($this->persistency) + { + $this->db_connect_id = (!$new_link) ? @pg_pconnect($connect_string) : @pg_pconnect($connect_string, PGSQL_CONNECT_FORCE_NEW); + } + else + { + $this->db_connect_id = (!$new_link) ? @pg_connect($connect_string) : @pg_connect($connect_string, PGSQL_CONNECT_FORCE_NEW); + } if ($this->db_connect_id) { -- cgit v1.2.1