|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #56394 constructor optional arguements are qwerky
Submitted: 2005-05-18 22:32 UTC Modified: 2005-10-23 09:26 UTC
From: david dot tulloh at infaze dot com dot au Assigned:
Status: No Feedback Package: PDO_PGSQL (PECL)
PHP Version: 5.0.3 OS: linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-05-18 22:32 UTC] david dot tulloh at infaze dot com dot au
Running php 5.0.4, pdo 0.3, pdo_pgsql 0.2, postgresql 8

I am used to using the user=x syntax in the connect string and was happy to see pdo support it.  However I ran into a few problems when I wanted to include driver options.

It seemed that pdo was adding an extra user= flag, causing postgresql to have a few problems and the connection to fail.

I think an additional (connect string, options array) syntax would be great.  Alternatively just check the string length.

Reproduce code:
$conn = new PDO("pgsql:dbname=benchmarking user=benchmarking");
$conn = new PDO("pgsql:dbname=benchmarking user=benchmarking", array(PDO_ATTR_PERSISTENT=>true));
$conn = new PDO("pgsql:dbname=benchmarking user=benchmarking",,, array(PDO_ATTR_PERSISTENT=>true));
$conn = new PDO("pgsql:dbname=benchmarking user=benchmarking", "", "", array(PDO_ATTR_PERSISTENT=>true));
$conn = new PDO("pgsql:dbname=benchmarking, "benchmarking", "", array(PDO_ATTR_PERSISTENT=>true));

Expected result:
I expected/hoped all of the above would give a sucessful connection.

Actual result:
fails - wrong parameters
fails - php error
fails - postgresql error


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-10 02:17 UTC]
Obviously you can't omit the parameter completely, as the PHP language doesn't support that.

Try using null instead of "".
 [2005-10-23 09:26 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 17 15:01:31 2024 UTC