From cebf7ba7cd1139083228d5d20420209f0295a6ff Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Wed, 27 Nov 2024 12:48:02 +0100 Subject: [PATCH] Update ReflectorFactory.php --- tests/ReflectorFactory.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/ReflectorFactory.php b/tests/ReflectorFactory.php index a0ff4ad03..568f2a39d 100644 --- a/tests/ReflectorFactory.php +++ b/tests/ReflectorFactory.php @@ -94,11 +94,13 @@ public static function create(string $cacheDir): QueryReflector $options[PDO::MYSQL_ATTR_SSL_CA] = $ssl; $options[PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = false; } - $pdo = new PDO(sprintf('mysql:dbname=%s;host=%s;port=%s', $dbname, $host, $port), $user, $password, $options); + $port = $port != null ? ';port='.$port : ''; + $pdo = new PDO(sprintf('mysql:dbname=%s;host=%s', $dbname, $host). $port, $user, $password, $options); $reflector = new PdoMysqlQueryReflector($pdo); $schemaHasher = new SchemaHasherMysql($pdo); } elseif ('pdo-pgsql' === $reflector) { - $pdo = new PDO(sprintf('pgsql:dbname=%s;host=%s;port=%s', $dbname, $host, $port), $user, $password); + $port = $port != null ? ';port='.$port : ''; + $pdo = new PDO(sprintf('pgsql:dbname=%s;host=%s', $dbname, $host). $port, $user, $password); $reflector = new PdoPgSqlQueryReflector($pdo); } else { throw new \RuntimeException('Unknown reflector: ' . $reflector);