From c627c85f18ab00f328dc7858a723df300897e13f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= Date: Thu, 28 Nov 2024 21:03:25 +0100 Subject: [PATCH] [BUGFIX] Avoid TypeError for database port handling Using the `typo3DatabasePort` environment variable to define the database server port string-casts the value to an string which is not compatible with the mysqli method `mysqli::real_connect()` and fails with: TypeError: mysqli::real_connect(): Argument #5 ($port) must be of type ?int, string given This change casts the database port to an integer in case a port is provided to avoid PHP TypeError when passing to `mysqli::real_connect()` to align with `ConnectionPool`, which is not used to create the database for the functional test instance. Resolves: #631 Releases: main, 8 --- Classes/Core/Testbase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Core/Testbase.php b/Classes/Core/Testbase.php index 45244563..d1cfa339 100644 --- a/Classes/Core/Testbase.php +++ b/Classes/Core/Testbase.php @@ -473,7 +473,7 @@ public function getOriginalDatabaseSettingsFromEnvironmentOrLocalConfiguration(a $originalConfigurationArray['DB']['Connections']['Default']['password'] = $databasePasswordTrimmed; } if ($databasePort) { - $originalConfigurationArray['DB']['Connections']['Default']['port'] = $databasePort; + $originalConfigurationArray['DB']['Connections']['Default']['port'] = (int)$databasePort; } if ($databaseSocket) { $originalConfigurationArray['DB']['Connections']['Default']['unix_socket'] = $databaseSocket;