No ability to connect to database named 't;', no chance to escape semicolon
| Bug #50323 | No ability to connect to database named 't;', no chance to escape semicolon | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2009-11-29 13:25 UTC | Modified: | 2009-12-06 19:34 UTC |
|
||||||
| From: | winner5 at interia dot pl | Assigned: | ||||||||
| Status: | Closed | Package: | PDO related | |||||||
| PHP Version: | 5.3.1 | OS: | Linux | |||||||
| Private report: | No | CVE-ID: | None | |||||||
[2009-11-29 13:25 UTC] winner5 at interia dot pl
Description:
------------
There is no way to escape semicolon in dsn to be treated like a char, not as a separator.
Reproduce code:
---------------
<?php
$pdo = new PDO('mysql:host=localhost;dbname=t\\;', 'user', 'pass');
?>
Expected result:
----------------
Successfully established connection
Actual result:
--------------
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000] [1049] Unknown database 't\'' in ./index.php:1
Stack trace:
#0 ./index.php(1): PDO->__construct('mysql:host=loca...', 'user', 'pass')
#1 {main}
thrown in ./index.php on line 1
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2009-11-29 14:09 UTC] alfredorj at walla dot com
[2009-11-29 21:29 UTC] kelt3we at gmail dot com
[2009-11-29 23:11 UTC] fa@php.net
[2009-12-06 19:34 UTC] iliaa@php.net