Skip to content

PdoSessionHandler::buildDsnFromUrl not compatible with Doctrine Connection URL #40290

Closed
@bcremer

Description

@bcremer

Symfony version(s) affected: All Versions
Description
The Connection URL support in PdoSessionHandler does not support the unix_socket connection options like the doctrine connection factory does.

How to reproduce

.env

DATABASE_URL=mysql://myusername:mypassword@localhost/mydb?unix_socket=/run/proxysql/proxysql.sock

config/packages/doctrine.yaml

doctrine:
  dbal:
    driver:   "pdo_mysql"
    url: '%env(resolve:DATABASE_URL)%'

config/services.yaml

  Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler:
    arguments:
      - '%env(DATABASE_URL)%'
      - { db_table: 'Session' }

The doctrine connection and components direly using the PDO Connection will work. Setup of the Session Handler will fail because the unix_socket part will be discarded.

Possible Solution
Add support for unix_socket in PdoSessionHandler::buildDsnFromUrl

Would you accept a PR adding unix_socket support to buildDsnFromUrl?

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