From 879bc89524aa98874d6de45dc057cb7ff45bd7ed Mon Sep 17 00:00:00 2001
From: Andreas Fischer <bantu@phpbb.com>
Date: Tue, 8 Jun 2010 19:27:55 +0200
Subject: [PATCH] [ticket/9643] Only split $port from $sqlserver, if it's not
 an IPv6 address.

PHPBB3-9643
---
 phpBB/includes/db/postgres.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php
index b3139b3d79..2a885f1d04 100644
--- a/phpBB/includes/db/postgres.php
+++ b/phpBB/includes/db/postgres.php
@@ -46,7 +46,10 @@ class dbal_postgres extends dbal
 
 		if ($sqlserver)
 		{
-			if (strpos($sqlserver, ':') !== false)
+			// $sqlserver can carry a port separated by : for compatibility reasons
+			// If $sqlserver has more than one : it's probably an IPv6 address.
+			// In this case we only allow passing a port via the $port variable.
+			if (substr_count($sqlserver, ':') === 1)
 			{
 				list($sqlserver, $port) = explode(':', $sqlserver);
 			}