Skip to content

Commit 677ab6a

Browse files
committed
Merge branch '3.9.x' into 3.10.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 654342e + 4a4e2ee commit 677ab6a

File tree

4 files changed

+64
-4
lines changed

4 files changed

+64
-4
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ jobs:
134134
- "10.6" # LTS (Jul 2026) We have code specific to 10.6.0-10.10.0
135135
- "10.11" # LTS (Feb 2028) We have code specific to ^10.10
136136
- "11.4" # LTS (May 2029)
137+
- "11.8" # LTS (Jun 2028)
137138
extension:
138139
- "mysqli"
139140
- "pdo_mysql"
@@ -162,7 +163,7 @@ jobs:
162163
mysql-version:
163164
- "5.7"
164165
- "8.0" # We have code specific to ^8.0
165-
- "9.1"
166+
- "9.3"
166167
extension:
167168
- "mysqli"
168169
- "pdo_mysql"

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@
4343
"doctrine/coding-standard": "13.0.0",
4444
"fig/log-test": "^1",
4545
"jetbrains/phpstorm-stubs": "2023.1",
46-
"phpstan/phpstan": "2.1.1",
46+
"phpstan/phpstan": "2.1.17",
4747
"phpstan/phpstan-strict-rules": "^2",
48-
"phpunit/phpunit": "9.6.22",
48+
"phpunit/phpunit": "9.6.23",
4949
"slevomat/coding-standard": "8.16.2",
50-
"squizlabs/php_codesniffer": "3.12.0",
50+
"squizlabs/php_codesniffer": "3.13.1",
5151
"symfony/cache": "^5.4|^6.0|^7.0",
5252
"symfony/console": "^4.4|^5.4|^6.0|^7.0"
5353
},

src/Driver/PgSQL/Driver.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use function func_get_args;
1616
use function implode;
1717
use function pg_connect;
18+
use function preg_match;
1819
use function restore_error_handler;
1920
use function set_error_handler;
2021
use function sprintf;
@@ -64,9 +65,18 @@ private function constructConnectionString(
6465
#[SensitiveParameter]
6566
array $params
6667
): string {
68+
// pg_connect used by Doctrine DBAL does not support [...] notation,
69+
// but requires the host address in plain form like `aa:bb:99...`
70+
$matches = [];
71+
if (isset($params['host']) && preg_match('/^\[(.+)\]$/', $params['host'], $matches) === 1) {
72+
$params['hostaddr'] = $matches[1];
73+
unset($params['host']);
74+
}
75+
6776
$components = array_filter(
6877
[
6978
'host' => $params['host'] ?? null,
79+
'hostaddr' => $params['hostaddr'] ?? null,
7080
'port' => $params['port'] ?? null,
7181
'dbname' => $params['dbname'] ?? 'postgres',
7282
'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)