Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Cache] Using instanceof to identify DBAL driver is no longer reliable with DBAL v3 #42022

Copy link
Copy link
Closed
@Jean85

Description

@Jean85
Issue body actions

Symfony version(s) affected: 3.4.43+, 4.4.11+, 5.0.11+, 5.1.3+ and onward

Description
Due to #37342, when using the PDOAdapter for cache, the driver detection switched to an instanceof approach. This is pretty unstable, due to the fact that wrapping the DBAL driver with your own implementation should be a fine approach, and it's even encouraged by the Middleware interface introduced in DBAL 3: https://github.com/doctrine/dbal/blob/3.1.x/src/Portability/Middleware.php#L24-L31

How to reproduce
See getsentry/sentry-symfony#530, which was the original reported issue.

Possible Solution
Use $this->conn->getDatabasePlatform()->getName() as a way to punch through the possible layers of wrapping middlewares and obtain a reliable platform name.

Additional context
I don't know the original reason for doing the original PR, since it's dubbed "fix compat for DBAL v3". @nicolas-grekas can you share some insights on that? Is there any reason to NOT take this approach?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.