Skip to content

Commit

Permalink
[BUGFIX] Avoid TypeError for database port handling
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sbuerk committed Nov 29, 2024
1 parent fbe41d2 commit c627c85
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Classes/Core/Testbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c627c85

Please sign in to comment.