Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix deprecations for deprecated mysql server versions #1781

Merged
merged 1 commit into from
Apr 7, 2024

Conversation

dmaicher
Copy link
Contributor

@dmaicher dmaicher commented Mar 21, 2024

Fixes

  9x: Support for MySQL < 8 is deprecated and will be removed in DBAL 5 (AbstractMySQLDriver.php:60 called by ConnectionFactory.php:122, https://github.com/doctrine/dbal/pull/6343, package doctrine/dbal)
    2x in XmlDoctrineExtensionTest::testDbalSchemaFilterNewConfig from Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection
    2x in YamlDoctrineExtensionTest::testDbalSchemaFilterNewConfig from Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection
    1x in ConnectionFactoryTest::testDefaultCharsetMySql from Doctrine\Bundle\DoctrineBundle\Tests
    1x in ConnectionFactoryTest::testDefaultCollationMySql from Doctrine\Bundle\DoctrineBundle\Tests
    1x in ConnectionFactoryTest::testDbnameSuffixForReplicas from Doctrine\Bundle\DoctrineBundle\Tests
    ...

now deprecation free:

..S......SSSSS.................................................  63 / 328 ( 19%)
.....................SSS....................................... 126 / 328 ( 38%)
.........................................S..................... 189 / 328 ( 57%)
..................................S............................ 252 / 328 ( 76%)
............................................................... 315 / 328 ( 96%)
.............                                                   328 / 328 (100%)

Time: 00:01.739, Memory: 48.50 MB

OK, but incomplete, skipped, or risky tests!
Tests: 328, Assertions: 1174, Skipped: 11.

Legacy deprecation notices (96)

@@ -120,7 +120,10 @@ public function createConnection(array $params, ?Configuration $config = null, ?
$driver = $connection->getDriver();
/** @psalm-suppress InvalidScalarArgument Bogus error, StaticServerVersionProvider implements Doctrine\DBAL\ServerVersionProvider */
$platform = $driver->getDatabasePlatform(
...(class_exists(StaticServerVersionProvider::class) ? [new StaticServerVersionProvider($params['serverVersion'] ?? '')] : []),
...(class_exists(StaticServerVersionProvider::class)
? [new StaticServerVersionProvider($params['serverVersion'] ?? $params['primary']['serverVersion'] ?? '')]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to check this one a bit more: might be a bug

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indeed was a bug however not really a big issue. The only thing we need to know further below is if $platform is an instance of AbstractMySQLPlatform and thats true anyway no matter which mysql version we use.

But this fix is needed to be deprecation free and to use the proper static version then.

This is in line with https://github.com/doctrine/dbal/blob/c70bae9e69e0e543044d5e282a624d9b3cbea6fb/src/Connection.php#L185-L189

@dmaicher dmaicher marked this pull request as ready for review April 7, 2024 19:13
@dmaicher dmaicher requested a review from ostrolucky April 7, 2024 19:13
@dmaicher dmaicher added this to the 2.12.1 milestone Apr 7, 2024
@dmaicher dmaicher merged commit 6c058a8 into doctrine:2.12.x Apr 7, 2024
13 checks passed
@dmaicher dmaicher deleted the fix_deprecations branch April 7, 2024 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants