aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2011-07-16 22:19:02 -0400
committerNils Adermann <naderman@naderman.de>2011-07-16 22:19:02 -0400
commitaa0c3a0f455f40990d5c05802ccfd75dac2fd049 (patch)
tree9d33256f458badc07ef811fdb09198b7f390ff96 /phpBB/includes/db
parent61e33675be3f7bac2d12a4a1aaaa0894118459c0 (diff)
parent825d44fcc2b384729a8eb0c941c5d3509f967e4c (diff)
downloadforums-aa0c3a0f455f40990d5c05802ccfd75dac2fd049.tar
forums-aa0c3a0f455f40990d5c05802ccfd75dac2fd049.tar.gz
forums-aa0c3a0f455f40990d5c05802ccfd75dac2fd049.tar.bz2
forums-aa0c3a0f455f40990d5c05802ccfd75dac2fd049.tar.xz
forums-aa0c3a0f455f40990d5c05802ccfd75dac2fd049.zip
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/10226] Use is_numeric() instead of preg_replace() [ticket/10226] Allow mysqli connections via local sockets/pipes
Diffstat (limited to 'phpBB/includes/db')
-rw-r--r--phpBB/includes/db/mysqli.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/phpBB/includes/db/mysqli.php b/phpBB/includes/db/mysqli.php
index cea8d2db0e..db3846e7f7 100644
--- a/phpBB/includes/db/mysqli.php
+++ b/phpBB/includes/db/mysqli.php
@@ -43,7 +43,23 @@ class dbal_mysqli extends dbal
$this->dbname = $database;
$port = (!$port) ? NULL : $port;
- $this->db_connect_id = @mysqli_connect($this->server, $this->user, $sqlpassword, $this->dbname, $port);
+ // If port is set and it is not numeric, most likely mysqli socket is set.
+ // Try to map it to the $socket parameter.
+ $socket = NULL;
+ if ($port)
+ {
+ if (is_numeric($port))
+ {
+ $port = (int) $port;
+ }
+ else
+ {
+ $socket = $port;
+ $port = NULL;
+ }
+ }
+
+ $this->db_connect_id = @mysqli_connect($this->server, $this->user, $sqlpassword, $this->dbname, $port, $socket);
if ($this->db_connect_id && $this->dbname != '')
{