[BUGFIX] Fix call to strpos to find port number 78/19978/3
authorAlexander Opitz <opitz.alexander@googlemail.com>
Sun, 14 Apr 2013 22:21:19 +0000 (00:21 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 15 Apr 2013 08:22:04 +0000 (10:22 +0200)
With the introduction of lazy database loading we introduced
a bug for database host strings with a port number. This patch
fixes the call to strpos() by switching the arguments.

Fixes: #47221
Releases: 6.1
Related: #46880
Change-Id: I1da875b7be531929f96f3496e6a1357638a80305
Reviewed-on: https://review.typo3.org/19978
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Felix Kopp
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/Database/DatabaseConnection.php

index b0e1ef9..2c7cae2 100644 (file)
@@ -688,7 +688,7 @@ class Bootstrap {
 
                $databaseHost = TYPO3_db_host;
                // Check if a port was specified
-               if (strpos(':', $databaseHost) > 0) {
+               if (strpos($databaseHost, ':') > 0) {
                        list($databaseHost, $databasePort) = explode(':', $databaseHost);
                        $databaseConnection->setDatabasePort($databasePort);
                }
index a2dd865..47c1b24 100644 (file)
@@ -1613,7 +1613,7 @@ class DatabaseConnection {
                        'called without arguments. Use the setters instead.'
                );
                if ($host) {
-                       if (strpos(':', $host) > 0) {
+                       if (strpos($host, ':') > 0) {
                                list($databaseHost, $databasePort) = explode(':', $host);
                                $this->setDatabaseHost($databaseHost);
                                $this->setDatabasePort($databasePort);