symfony/http-foundation · error · InvalidArgumentException

Unsupported PDO OCI DSN. Try running "composer require…

Error message

Unsupported PDO OCI DSN. Try running "composer require doctrine/dbal".

What it means

An InvalidArgumentException thrown by SessionHandlerFactory::createHandler() when a pdo_oci:// DSN is supplied but Doctrine DBAL (DriverManager) is not installed, so the factory cannot translate the OCI DSN into a native PDO connection for PdoSessionHandler. It is a dependency-availability guard; the DSN scheme itself is recognized.

Solutions

  1. Run composer require doctrine/dbal to enable pdo_oci:// DSN support
  2. Use a directly supported PDO DSN instead (mysql://, pgsql://, sqlite://, sqlsrv://, mssql://) which needs no DBAL
  3. Create the OCI connection yourself and pass a PDO instance or DSN string PdoSessionHandler accepts
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at Session/Storage/Handler/SessionHandlerFactory.php:74 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of symfony/http-foundation@5aea19cd67 (2026-09-13). Data as JSON: /api/errors/1ad4f465e95212b5. Report an issue: GitHub.

Appendix: source

Thrown at Session/Storage/Handler/SessionHandlerFactory.php:74

            case str_starts_with($connection, 'pdo_oci://'):
                if (!class_exists(DriverManager::class)) {
                    throw new \InvalidArgumentException('Unsupported PDO OCI DSN. Try running "composer require doctrine/dbal".');
                }
                $connection[3] = '-';
                $params = (new DsnParser())->parse($connection);
                $config = new Configuration();
                $config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());

                $connection = DriverManager::getConnection($params, $config)->getNativeConnection();
                // no break;

            case str_starts_with($connection, 'mssql://'):
            case str_starts_with($connection, 'mysql://'):
            case str_starts_with($connection, 'mysql2://'):
            case str_starts_with($connection, 'pgsql://'):
            case str_starts_with($connection, 'postgres://'):
            case str_starts_with($connection, 'postgresql://'):
            case str_starts_with($connection, 'sqlsrv://'):
            case str_starts_with($connection, 'sqlite://'):
            case str_starts_with($connection, 'sqlite3://'):
                return new PdoSessionHandler($connection, $options);

View on GitHub (pinned to 5aea19cd67)