From ce5b4d1d614fb2eeaaac8a99c5a1a9e83a1cc8b5 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Mon, 22 Apr 2013 22:36:54 +0200 Subject: [PATCH] [TASK] Introduce $GLOBALS['TYPO3_CONF_VARS']['DB']['port'] MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The [db][host] setting can contain a hostname, followed by a colon and a port. This was ok with mysql, as it accepted host and port in one parameter. With the switch to mysqli, host and port must be given as single parameters, forcing the core to split host and port. This can fail especially if the host is an ipv6 address. In order to separate this in a better way, the new "port" parameter in TYPO3_CONF_VARS DB is introduced. If set, the host will not be splitted by colon anymore, but host and port setting will be used as given. Resolves: #47455 Releases: 6.2, 6.1 Change-Id: I3096d166e574d9b6045ac92ed3dc8b2c48ef94d2 Reviewed-on: https://review.typo3.org/20093 Reviewed-by: Daniel Hürtgen Reviewed-by: Jigal van Hemert Tested-by: Jigal van Hemert Reviewed-by: Christian Kuhn Tested-by: Christian Kuhn --- NEWS.txt | 7 +++++++ typo3/sysext/core/Classes/Core/Bootstrap.php | 7 ++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/NEWS.txt b/NEWS.txt index 933e790e4257..498bc4771aaa 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -38,6 +38,13 @@ changes -- all extension code using the API should run as before. "mysqli" is now a hard requirement in the PHP environment and must be loaded for TYPO3 to run. +* Separated database host and port setting + +As a side effect of the switch to mysqli, the database settings in +TYPO3_CONF_VARS DB now accept a new "port" setting. This setting must be used +if the database host is a ipv6 address and the port is different from the +default port 3306, otherwise the backwards compatible logic could fail. + ------------------------------------------------------------------------------- Deprecated and removed components ------------------------------------------------------------------------------- diff --git a/typo3/sysext/core/Classes/Core/Bootstrap.php b/typo3/sysext/core/Classes/Core/Bootstrap.php index 7ac3041f0d90..7bf89e776832 100644 --- a/typo3/sysext/core/Classes/Core/Bootstrap.php +++ b/typo3/sysext/core/Classes/Core/Bootstrap.php @@ -255,7 +255,6 @@ class Bootstrap { isset($GLOBALS['TYPO3_CONF_VARS']['DB']['extTablesDefinitionScript']) ? $GLOBALS['TYPO3_CONF_VARS']['DB']['extTablesDefinitionScript'] : 'extTables.php'); - unset($GLOBALS['TYPO3_CONF_VARS']['DB']); define('TYPO3_user_agent', 'User-Agent: ' . $GLOBALS['TYPO3_CONF_VARS']['HTTP']['userAgent']); return $this; } @@ -690,8 +689,10 @@ class Bootstrap { $databaseConnection->setDatabasePassword(TYPO3_db_password); $databaseHost = TYPO3_db_host; - // Check if a port was specified - if (strpos($databaseHost, ':') > 0) { + if (isset($GLOBALS['TYPO3_CONF_VARS']['DB']['port'])) { + $databaseConnection->setDatabasePort($GLOBALS['TYPO3_CONF_VARS']['DB']['port']); + } elseif (strpos($databaseHost, ':') > 0) { + // @TODO: Find a way to handle this case in the install tool and drop this list($databaseHost, $databasePort) = explode(':', $databaseHost); $databaseConnection->setDatabasePort($databasePort); } -- 2.20.1