Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connection to Postgresql fail to translate host name #7399

Closed
photodude opened this issue Oct 3, 2016 · 9 comments
Closed

connection to Postgresql fail to translate host name #7399

photodude opened this issue Oct 3, 2016 · 9 comments

Comments

@photodude
Copy link
Contributor

photodude commented Oct 3, 2016

HHVM Version

3.16.0-dev (hhvm-nightly)

Standalone code, or other way to reproduce the problem

Joomla Postgresql driver (below is a snip from the driver that hopefully would represent Standalone code)

$dsn .= "host={localhost} ";
$dsn .= "dbname={joomla_ut} user={postgres} password={}";
$this->connection = @pg_connect($dsn)

Expected result

connection to Postgresql without PDOExceptions, previously worked in 3.15 and with the old 3rdparty pgsql module

Actual result

PDOException: [112]: could not translate host name "localhost port=5432 dbname=joomla_ut" to address: Name or service not known

@paulbiss
Copy link
Contributor

paulbiss commented Oct 3, 2016

cc @simonwelsh

@photodude
Copy link
Contributor Author

Looks like this maybe an environment configuration issue, I'm going to close this and open an issue with Travis CI. I'll reopen if there is no environment configuration issues

@photodude
Copy link
Contributor Author

Reopening since I was unable to replicate the issue with similar environment with php 5.6. Seems to be only happening in HHVM.

@photodude photodude reopened this Oct 3, 2016
@simonwelsh
Copy link
Contributor

@photodude are you able to get the raw DSN being used? The code you've pasted is for pg_connect but the error is for PDO.

@photodude
Copy link
Contributor Author

photodude commented Oct 3, 2016

Yes @simonwelsh I believe this is the raw DSN from the phpunit xml file

<const name="JTEST_DATABASE_POSTGRESQL_DSN" value="host=localhost;port=5432;dbname=joomla_ut;user=postgres;pass=" />

it's parsed by this section of the phpunit setup https://github.com/joomla/joomla-cms/blob/staging/tests/unit/core/case/database/postgresql.php#L35-L107

@photodude
Copy link
Contributor Author

photodude commented Oct 4, 2016

Maybe the error is from the PDO pgsql portion of phpUnit which is used to set up the tests

$pdo = new PDO($dsn, self::$_options['user'], self::$_options['password']);
return $this->createDefaultDBConnection($pdo, self::$_options['database']);

@simonwelsh
Copy link
Contributor

Ah, it's using spaces instead of semicolons as delimiters. Must've missed that when I switched from a custom DSN parser to the one already in HHVM. Should be easy enough to fix.

@photodude
Copy link
Contributor Author

We look forward to a patch to fix the DSN parser to allow spaces.

simonwelsh added a commit to simonwelsh/hhvm that referenced this issue Oct 7, 2016
pdo_pgsql allows seperatoring values with a space as well as a
semicolon. Add support to the DSN parser for multiple seperator
characters and set pdo_pgsql to allow ';' and ' '. pdo_mysql, currently
the only other connector using this parser, does not change.

Fixes facebook#7399.
@photodude
Copy link
Contributor Author

Thanks @simonwelsh @Orvid @aorenste

aorenste added a commit that referenced this issue Nov 21, 2016
Summary:
pdo_pgsql allows seperatoring values with a space as well as a
semicolon. Add support to the DSN parser for multiple seperator
characters and set pdo_pgsql to allow ';' and ' '. pdo_mysql, currently
the only other connector using this parser, does not change.

Fixes #7399.
Closes #7409
Github Author: Simon Welsh <simon@simon.geek.nz>

Github PR Sync: {sync, type="child", parent="github", parentrepo="facebook/hhvm", parentprnum="7409", parentprfbid="341168139567521"}

Test Plan: Imported from GitHub, without a `Test Plan:` line.

Reviewers: svcscm

Reviewed By: svcscm

Subscribers: svcscm, hphp-diffs@, cdykes, michaelofarrell

Differential Revision: https://phabricator.intern.facebook.com/D3995081

Signature: t1:3995081:1476657792:9b373a7d999f35880998ebd46ef1f8d1850a9234
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants