Bug #71310 [NEW]: Not clear how to enter DSN with special characters
From: sustmidown at centrum dot cz
Operating system: Linux x86-64
PHP version: 5.6.17
Package: PDO Core
Bug Type: Bug
Bug description:Not clear how to enter DSN with special characters
Description:
------------
Manual page: http://www.php.net/pdo.construct
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=127.0.0.1;dbname=asdf;asdf';
$dsn = 'pgsql:host=127.0.0.1;dbname=asdf\;asdf';
$dsn = 'pgsql:host=127.0.0.1;dbname=asdf%3basdf';
$dsn = 'pgsql:host=127.0.0.1;dbname=asdf%3Basdf';
but none of those works.
If I create database named "asdf/asdf", DSN:
$dsn = 'pgsql:host=127.0.0.1;dbname=asdf/asdf';
work, but according to
https://pear.php.net/manual/en/package.database.db.intro-dsn.php
you should basicly url-encode parameters.
But both:
$dsn = 'pgsql:host=127.0.0.1;dbname=asdf%2fasdf';
$dsn = 'pgsql:host=127.0.0.1;dbname=asdf%2Fasdf';
do not work.
Expected result:
----------------
PDO constructor should support DSN string that contain database name
with semicolon in it.
--
Edit bug report at https://bugs.php.net/bug.php?id=71310&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71310&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71310&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71310&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71310&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71310&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71310&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71310&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71310&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71310&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71310&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71310&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71310&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71310&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71310&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71310&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71310&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71310&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71310&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71310&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71310&r=mysqlcfg
Thread (1 message)
- sustmidown at centrum dot cz