php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62479 PDO-psql cannot connect if password contains spaces
Submitted: 2012-07-04 08:56 UTC Modified: 2014-01-19 01:43 UTC
Votes:3
Avg. Score:4.0 ± 0.8
Reproduced:2 of 3 (66.7%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: brice at bmaron dot net Assigned: willfitch (profile)
Status: Closed Package: PDO PgSQL
PHP Version: 5.3.14 OS: Linux- Debian Stable
Private report: No CVE-ID: None
 [2012-07-04 08:56 UTC] brice at bmaron dot net
Description:
------------
When you try to connect to a Postgresql database with a password containing 1 or more spaces, pdo will fail to connect.

You must escape yourself the user & password and put it into the dsn to make it work.

It may also be true for other databases ... it's not tested

Test script:
---------------
https://gist.github.com/3046155

Expected result:
----------------
See a connection and no error for both tries 

Actual result:
--------------
See an error for the first one and a correct result for the second one

Patches

PDOPostgreSQLPassword (last revision 2012-10-31 01:51 UTC by iliaa@php.net)

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-07-04 12:29 UTC] brice at bmaron dot net
It seems to be a pdo-psql only ... not affecting other drivers like mysql
 [2012-09-17 19:38 UTC] willfitch@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: willfitch
 [2012-09-17 19:39 UTC] willfitch@php.net
I have confirmed your findings. Let me do a little sniffing around and see what I 
can come up with.
 [2012-09-20 20:12 UTC] willfitch@php.net
Pull request for this bug has been submitted at: https://github.com/php/php-
src/pull/199.
 [2012-10-31 01:51 UTC] iliaa@php.net
The following patch has been added/updated:

Patch Name: PDOPostgreSQLPassword
Revision:   1351648300
URL:        https://bugs.php.net/patch-display.php?bug=62479&patch=PDOPostgreSQLPassword&revision=1351648300
 [2012-10-31 01:53 UTC] iliaa@php.net
I think the attached patch maybe slightly better than the one proposed, the 
attached patch also accounts for passwords that may contain \ character inside 
them.
 [2012-10-31 18:47 UTC] willfitch@php.net
Thanks Iliaa -

I will update the pull request to take into account escaping backslashes as well.
 [2013-07-22 04:37 UTC] stas@php.net
Will, any news on the updated patch?
 [2013-11-08 15:09 UTC] willfitch@php.net
@stas - last I heard we're taking Iliaa's patch that's attached here.
 [2014-01-01 12:37 UTC] felipe@php.net
-Package: PDO related +Package: PDO PgSQL
 [2014-01-08 15:22 UTC] willfitch@php.net
It doesn't look like any patch was applied and there are conflicts with both Iliaa's and my previous patches.  I'm going to merge the patches/conflicts and make a new PR on Github.
 [2014-01-10 02:49 UTC] willfitch@php.net
Updated PR here: https://github.com/php/php-src/pull/557
 [2014-01-18 22:05 UTC] willfitch@php.net
I plan on merging this tonight unless I have pushback.  This will go upstream from 5.3+
 [2014-01-19 00:49 UTC] willfitch@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e6bb90c66a5306f3db7ca38206b27685177a65cc
Log: Fix #62479: Some chars not parsed in passwords
 [2014-01-19 00:49 UTC] willfitch@php.net
-Status: Verified +Status: Closed
 [2014-01-19 00:49 UTC] willfitch@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=da83b513b21c88f58bf0c2e56c2e46359535e160
Log: Fix #62479: Some chars not parsed in passwords
 [2014-01-19 01:35 UTC] ab@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=da83b513b21c88f58bf0c2e56c2e46359535e160
Log: Fix #62479: Some chars not parsed in passwords
 [2014-01-19 01:40 UTC] ab@php.net
Hi,

i don't quite get why we need the PDOTEST_DSN along with PDO_PGSQL_TEST_DSN. Those would differentiate themselves only with the password= param. Maybe just cutoff the password param from PDO_PGSQL_TEST_DSN? Were simpler than having to set PDOTEST_DSN just for this one test. Will need to be fixed somewhen.

Cheers.
 [2014-01-19 01:43 UTC] willfitch@php.net
@ab - agreed.  Not sure where the logic was when that was created, but I avoid using it.
 [2014-01-19 18:03 UTC] willfitch@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8aa93b7f2cb23dc4c7a051276cec833fd4343c1d
Log: Revert "Fix #62479: Some chars not parsed in passwords"
 [2014-01-19 18:12 UTC] willfitch@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b2606f669ae30b35bc18cb3eb0f7ebfcbf2620f7
Log: Update NEWS for bug fix #62479
 [2014-01-21 01:57 UTC] tyrael@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b2606f669ae30b35bc18cb3eb0f7ebfcbf2620f7
Log: Update NEWS for bug fix #62479
 [2014-01-21 01:57 UTC] tyrael@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b2606f669ae30b35bc18cb3eb0f7ebfcbf2620f7
Log: Update NEWS for bug fix #62479
 [2014-01-21 09:55 UTC] tyrael@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b2606f669ae30b35bc18cb3eb0f7ebfcbf2620f7
Log: Update NEWS for bug fix #62479
 [2014-01-21 16:36 UTC] ab@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b2606f669ae30b35bc18cb3eb0f7ebfcbf2620f7
Log: Update NEWS for bug fix #62479
 [2014-01-24 15:11 UTC] tyrael@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8aa93b7f2cb23dc4c7a051276cec833fd4343c1d
Log: Revert "Fix #62479: Some chars not parsed in passwords"
 [2014-01-24 15:11 UTC] tyrael@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e6bb90c66a5306f3db7ca38206b27685177a65cc
Log: Fix #62479: Some chars not parsed in passwords
 [2014-01-24 15:12 UTC] tyrael@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8aa93b7f2cb23dc4c7a051276cec833fd4343c1d
Log: Revert "Fix #62479: Some chars not parsed in passwords"
 [2014-01-24 15:12 UTC] tyrael@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e6bb90c66a5306f3db7ca38206b27685177a65cc
Log: Fix #62479: Some chars not parsed in passwords
 [2014-01-24 15:12 UTC] tyrael@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8aa93b7f2cb23dc4c7a051276cec833fd4343c1d
Log: Revert "Fix #62479: Some chars not parsed in passwords"
 [2014-01-24 15:12 UTC] tyrael@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e6bb90c66a5306f3db7ca38206b27685177a65cc
Log: Fix #62479: Some chars not parsed in passwords
 [2014-01-24 15:13 UTC] tyrael@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8aa93b7f2cb23dc4c7a051276cec833fd4343c1d
Log: Revert "Fix #62479: Some chars not parsed in passwords"
 [2014-01-24 15:13 UTC] tyrael@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e6bb90c66a5306f3db7ca38206b27685177a65cc
Log: Fix #62479: Some chars not parsed in passwords
 [2014-01-24 21:51 UTC] ab@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8aa93b7f2cb23dc4c7a051276cec833fd4343c1d
Log: Revert "Fix #62479: Some chars not parsed in passwords"
 [2014-01-24 21:51 UTC] ab@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e6bb90c66a5306f3db7ca38206b27685177a65cc
Log: Fix #62479: Some chars not parsed in passwords
 [2014-02-12 08:46 UTC] tyrael@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8aa93b7f2cb23dc4c7a051276cec833fd4343c1d
Log: Revert "Fix #62479: Some chars not parsed in passwords"
 [2014-02-12 08:46 UTC] tyrael@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e6bb90c66a5306f3db7ca38206b27685177a65cc
Log: Fix #62479: Some chars not parsed in passwords
 [2014-10-07 23:16 UTC] stas@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=b2606f669ae30b35bc18cb3eb0f7ebfcbf2620f7
Log: Update NEWS for bug fix #62479
 [2014-10-07 23:16 UTC] stas@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=8aa93b7f2cb23dc4c7a051276cec833fd4343c1d
Log: Revert "Fix #62479: Some chars not parsed in passwords"
 [2014-10-07 23:16 UTC] stas@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=da83b513b21c88f58bf0c2e56c2e46359535e160
Log: Fix #62479: Some chars not parsed in passwords
 [2014-10-07 23:16 UTC] stas@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=e6bb90c66a5306f3db7ca38206b27685177a65cc
Log: Fix #62479: Some chars not parsed in passwords
 [2014-10-07 23:27 UTC] stas@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=b2606f669ae30b35bc18cb3eb0f7ebfcbf2620f7
Log: Update NEWS for bug fix #62479
 [2014-10-07 23:27 UTC] stas@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=8aa93b7f2cb23dc4c7a051276cec833fd4343c1d
Log: Revert "Fix #62479: Some chars not parsed in passwords"
 [2014-10-07 23:27 UTC] stas@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=da83b513b21c88f58bf0c2e56c2e46359535e160
Log: Fix #62479: Some chars not parsed in passwords
 [2014-10-07 23:27 UTC] stas@php.net
Automatic comment on behalf of willfitch
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=e6bb90c66a5306f3db7ca38206b27685177a65cc
Log: Fix #62479: Some chars not parsed in passwords
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 09:01:30 2024 UTC