Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

pg_connect params encodings #6760

Closed
ishenkoyv opened this issue Oct 13, 2014 · 4 comments
Closed

pg_connect params encodings #6760

ishenkoyv opened this issue Oct 13, 2014 · 4 comments
Assignees
Labels
Milestone

Comments

@ishenkoyv
Copy link

https://github.com/zendframework/zf2/blob/master/library/Zend/Db/Adapter/Driver/Pgsql/Connection.php#LC180

$connection = http_build_query($connection, null, ' '); // @link http://php.net/pg_connect

I can't connect to postgres if params contain special symbols, e.g. '!' as connection string represents them in url encoded way.
So if my config db section looks like

'db' => array(
    'adapters' => array(
        'db' => array(
            'driver'    => 'pgsql',
            'host' => 'localhost',
            'post' => '5432',
            'dbname' => 'test',
            'username'  => 'test',
            'password'  => 'test123',
        ),
    ),
),

the produced connection string will be
'host=localhost user=test password=test123%21 dbname=test'

There is link to http://php.net/pg_connect in code but really I don't understand what I should find there.
Is there reason to use http_build_query against connection string through the connection method for psql driver or it's a legacy code which should be removed?

Best regards

@jeremyquinton
Copy link
Contributor

The example configuration you have given for
'password' => 'test123' I think you intended to write
'password' => 'test123!'

This certainly is pretty limiting and can be improved upon as passwords can contain symbols. I also find the use of http_build_query quite interesting.

@samsonasik
Copy link
Contributor

@ishenkoyv @jeremyquinton I created PR #6787 for it

@jeremyquinton
Copy link
Contributor

👍

@Ocramius Ocramius added this to the 2.3.4 milestone Dec 31, 2014
@Ocramius Ocramius self-assigned this Dec 31, 2014
Ocramius added a commit that referenced this issue Dec 31, 2014
Ocramius added a commit that referenced this issue Dec 31, 2014
Ocramius added a commit that referenced this issue Dec 31, 2014
Ocramius added a commit that referenced this issue Dec 31, 2014
Ocramius added a commit that referenced this issue Dec 31, 2014
@Ocramius
Copy link
Member

Handled in #6787

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants