|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71310 Not clear how to enter DSN with special characters
Submitted: 2016-01-08 13:01 UTC Modified: 2017-10-24 08:31 UTC
From: sustmidown at centrum dot cz Assigned:
Status: Open Package: PDO related
PHP Version: 5.6.17 OS: Linux x86-64
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-01-08 13:01 UTC] sustmidown at centrum dot cz
Manual page:
has no information about how to specify DSN parameters with special characters.

For example PostgreSQL supports database names containing slash (/) or even semicolon (;).
How should I encode DSN dbname parameter to connect to a database named "qwer;asdf"?

I tried:

$dsn = 'pgsql:host=;dbname=asdf;asdf';
$dsn = 'pgsql:host=;dbname=asdf\;asdf';
$dsn = 'pgsql:host=;dbname=asdf%3basdf';
$dsn = 'pgsql:host=;dbname=asdf%3Basdf';

but none of those works.

If I create database named "asdf/asdf", DSN:

$dsn = 'pgsql:host=;dbname=asdf/asdf';

work, but according to
you should basicly url-encode parameters.

But both:

$dsn = 'pgsql:host=;dbname=asdf%2fasdf';
$dsn = 'pgsql:host=;dbname=asdf%2Fasdf';

do not work.

Expected result:
PDO constructor should support DSN string that contain database name with semicolon in it.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-24 08:31 UTC]
-Package: PDO Core +Package: PDO related
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Jun 20 15:01:23 2021 UTC