Skip to content

Commit 710c77d

Browse files
committed
Merge branch '4.4.x' into 5.0.x
* 4.4.x: Make options check strict again Make options check strict again (doctrine#7141) Remove obsolete upgrade note (doctrine#7138) Document the PDO subclasses backport (doctrine#7137) Downgrade PHP for the DB2 workflow (doctrine#7134) Workaround for MySQL 8.4 and unknown users (doctrine#7136) Leverage PHP 8.4 PDO classes, fix PHP 8.5 deprecation (doctrine#7132) Run tests on MySQL 8.4 LTS and 9.4 (doctrine#7133)
2 parents 644196b + a5d5c51 commit 710c77d

File tree

4 files changed

+42
-21
lines changed

4 files changed

+42
-21
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -156,18 +156,19 @@ jobs:
156156
- "8.4"
157157
mysql-version:
158158
- "8.0"
159-
- "9.3"
159+
- "8.4" # LTS
160+
- "9.4"
160161
extension:
161162
- "mysqli"
162163
- "pdo_mysql"
163164
include:
164165
- config-file-suffix: "-tls"
165166
php-version: "8.4"
166-
mysql-version: "9.1"
167+
mysql-version: "9.4"
167168
extension: "mysqli"
168169
- config-file-suffix: "-stringify_fetches"
169170
php-version: "8.4"
170-
mysql-version: "9.1"
171+
mysql-version: "9.4"
171172
extension: "pdo_mysql"
172173

173174
phpunit-mssql:
@@ -190,17 +191,18 @@ jobs:
190191
- "Latin1_General_100_CI_AS_SC_UTF8"
191192
- "Latin1_General_100_CS_AS_SC_UTF8"
192193

193-
phpunit-ibm-db2:
194-
name: "PHPUnit with IBM DB2"
195-
needs: "phpunit-smoke-check"
196-
uses: ./.github/workflows/phpunit-db2.yml
197-
with:
198-
php-version: ${{ matrix.php-version }}
199-
200-
strategy:
201-
matrix:
202-
php-version:
203-
- "8.4"
194+
# The DB2 workflow currently segfaults with PHP 8.4
195+
# phpunit-ibm-db2:
196+
# name: "PHPUnit with IBM DB2"
197+
# needs: "phpunit-smoke-check"
198+
# uses: ./.github/workflows/phpunit-db2.yml
199+
# with:
200+
# php-version: ${{ matrix.php-version }}
201+
#
202+
# strategy:
203+
# matrix:
204+
# php-version:
205+
# - "8.4"
204206

205207
development-deps:
206208
name: "PHPUnit with PDO_SQLite and development dependencies"

UPGRADE.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -843,10 +843,7 @@ and `::dropUniqueConstraint()` respectively instead.
843843
## Support for new PDO subclasses on PHP 8.4
844844

845845
On PHP 8.4, if you call `getNativeConnection()` on a connection established through one of the PDO drivers,
846-
you will get an instance of the new PDO subclasses, e.g. `Pdo\Mysql` or `Pdo\Ppgsql` instead of just `PDO`.
847-
848-
However, this currently does not apply to persistent connections.
849-
See https://github.com/php/php-src/issues/16314 for details.
846+
you will get an instance of the new PDO subclasses, e.g. `Pdo\Mysql` or `Pdo\Pgsql` instead of just `PDO`.
850847

851848
## Minor BC break: incompatible query cache format
852849

@@ -1799,6 +1796,16 @@ The following methods have been removed.
17991796

18001797
# Upgrade to 3.10
18011798

1799+
## Support for new PDO subclasses on PHP 8.4
1800+
1801+
In 3.10.2, we've backported support for new PDO subclasses introduced in PHP 8.4 because not using them
1802+
could trigger deprecation warnings under certain circumstances in PHP 8.5.
1803+
1804+
On PHP 8.4, if you call `getNativeConnection()` on a connection established through one of the PDO drivers,
1805+
you will get an instance of the new PDO subclasses, e.g. `Pdo\Mysql` or `Pdo\Pgsql` instead of just `PDO`.
1806+
1807+
## Optional `doctrine/cache` dependency
1808+
18021809
The `doctrine/cache` package is now an optional dependency. If you are using the
18031810
`Doctrine\DBAL\Cache` classes, you need to require the `doctrine/cache` package
18041811
explicitly.

src/Driver/API/MySQL/ExceptionConverter.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
2323
use Doctrine\DBAL\Query;
2424

25+
use function str_contains;
26+
2527
/** @internal */
2628
final class ExceptionConverter implements ExceptionConverterInterface
2729
{
@@ -31,6 +33,15 @@ final class ExceptionConverter implements ExceptionConverterInterface
3133
*/
3234
public function convert(Exception $exception, ?Query $query): DriverException
3335
{
36+
if (
37+
$exception->getCode() === 1524
38+
&& str_contains($exception->getMessage(), 'Plugin \'mysql_native_password\' is not loaded')
39+
) {
40+
// Workaround for MySQL 8.4 if we request an unknown user.
41+
// https://bugs.mysql.com/bug.php?id=114876
42+
return new ConnectionException($exception, $query);
43+
}
44+
3445
return match ($exception->getCode()) {
3546
1008 => new DatabaseDoesNotExist($exception, $query),
3647
1213 => new DeadlockException($exception, $query),

src/Driver/PDO/PgSQL/Driver.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Doctrine\DBAL\Driver\PDO\Exception;
1010
use Doctrine\DBAL\Driver\PDO\Exception\InvalidConfiguration;
1111
use PDO;
12+
use Pdo\Pgsql;
1213
use PDOException;
1314
use SensitiveParameter;
1415

@@ -50,10 +51,10 @@ public function connect(
5051
}
5152

5253
if (
53-
! isset($driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES])
54-
|| $driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES] === true
54+
! isset($driverOptions[Pgsql::ATTR_DISABLE_PREPARES])
55+
|| $driverOptions[Pgsql::ATTR_DISABLE_PREPARES] === true
5556
) {
56-
$pdo->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true);
57+
$pdo->setAttribute(Pgsql::ATTR_DISABLE_PREPARES, true);
5758
}
5859

5960
$connection = new Connection($pdo);

0 commit comments

Comments
 (0)