Skip to content

Commit 545e932

Browse files
committed
Merge branch '3.9.x' into 4.2.x
* 3.9.x: Bump dev tools (#7002) fix(PgSQL): Allow to pass IPv6 address in URI notation for postgres (#6344) Run tests on MySQL 9.3 instead of 9.1 (#7001) CI MariaDB: add 11.8 (#6991)
2 parents b18e917 + 4a4e2ee commit 545e932

File tree

4 files changed

+63
-3
lines changed

4 files changed

+63
-3
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ jobs:
132132
- "10.6" # LTS (Jul 2026) We have code specific to 10.6.0-10.10.0
133133
- "10.11" # LTS (Feb 2028) We have code specific to ^10.10
134134
- "11.4" # LTS (May 2029)
135+
- "11.8" # LTS (Jun 2028)
135136
extension:
136137
- "mysqli"
137138
- "pdo_mysql"
@@ -160,7 +161,7 @@ jobs:
160161
mysql-version:
161162
- "5.7"
162163
- "8.0" # We have code specific to ^8.0
163-
- "9.1"
164+
- "9.3"
164165
extension:
165166
- "mysqli"
166167
- "pdo_mysql"

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@
4040
"doctrine/coding-standard": "13.0.0",
4141
"fig/log-test": "^1",
4242
"jetbrains/phpstorm-stubs": "2023.2",
43-
"phpstan/phpstan": "2.1.1",
43+
"phpstan/phpstan": "2.1.17",
4444
"phpstan/phpstan-phpunit": "2.0.3",
4545
"phpstan/phpstan-strict-rules": "^2",
4646
"phpunit/phpunit": "10.5.39",
4747
"slevomat/coding-standard": "8.16.2",
48-
"squizlabs/php_codesniffer": "3.12.0",
48+
"squizlabs/php_codesniffer": "3.13.1",
4949
"symfony/cache": "^6.3.8|^7.0",
5050
"symfony/console": "^5.4|^6.3|^7.0"
5151
},

src/Driver/PgSQL/Driver.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use function func_get_args;
1818
use function implode;
1919
use function pg_connect;
20+
use function preg_match;
2021
use function restore_error_handler;
2122
use function set_error_handler;
2223
use function sprintf;
@@ -66,9 +67,18 @@ private function constructConnectionString(
6667
#[SensitiveParameter]
6768
array $params,
6869
): string {
70+
// pg_connect used by Doctrine DBAL does not support [...] notation,
71+
// but requires the host address in plain form like `aa:bb:99...`
72+
$matches = [];
73+
if (isset($params['host']) && preg_match('/^\[(.+)\]$/', $params['host'], $matches) === 1) {
74+
$params['hostaddr'] = $matches[1];
75+
unset($params['host']);
76+
}
77+
6978
$components = array_filter(
7079
[
7180
'host' => $params['host'] ?? null,
81+
'hostaddr' => $params['hostaddr'] ?? null,
7282
'port' => $params['port'] ?? null,
7383
'dbname' => $params['dbname'] ?? 'postgres',
7484
'user' => $params['user'] ?? null,

tests/Driver/PgSQL/DriverTest.php

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Doctrine\DBAL\Tests\Driver\PgSQL;
6+
7+
use Doctrine\DBAL\Driver as DriverInterface;
8+
use Doctrine\DBAL\Driver\PgSQL\Driver;
9+
use Doctrine\DBAL\Tests\Driver\AbstractPostgreSQLDriverTestCase;
10+
use Doctrine\DBAL\Tests\TestUtil;
11+
12+
use function in_array;
13+
14+
class DriverTest extends AbstractPostgreSQLDriverTestCase
15+
{
16+
protected function setUp(): void
17+
{
18+
parent::setUp();
19+
20+
if (isset($GLOBALS['db_driver']) && $GLOBALS['db_driver'] === 'pgsql') {
21+
return;
22+
}
23+
24+
self::markTestSkipped('Test enabled only when using pgsql specific phpunit.xml');
25+
}
26+
27+
/**
28+
* Ensure we can handle URI notation for IPv6 addresses
29+
*/
30+
public function testConnectionIPv6(): void
31+
{
32+
if (! in_array($GLOBALS['db_host'], ['localhost', '127.0.0.1', '[::1]'], true)) {
33+
// We cannot assume that every contributor runs the same setup as our CI
34+
self::markTestSkipped('This test only works if there is a Postgres server listening on localhost.');
35+
}
36+
37+
self::expectNotToPerformAssertions();
38+
39+
$params = TestUtil::getConnectionParams();
40+
$params['host'] = '[::1]';
41+
42+
$this->driver->connect($params);
43+
}
44+
45+
protected function createDriver(): DriverInterface
46+
{
47+
return new Driver();
48+
}
49+
}

0 commit comments

Comments
 (0)