Re: Problems with DB in 4.2.0
| From: | Edin Kadribasic | Date: | Tue, 09 Apr 2002 16:41:58 +0000 |
| Subject: | Re: Problems with DB in 4.2.0 | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-5281@lists.php.net to get a copy of this message | ||
Having some more look at the code I can see in pgsql.php:
if ($protocol == 'tcp') {
$connstr = 'host=' . $dsninfo['hostspec'];
if ($dsninfo['port']) {
$connstr .= ' port=' . $dsninfo['port'];
}
}
Setting protocol to 'tcp' in dsn parser if no protocol is specified might
not be such a good idea. Quick fix for postgres would be to check if
$dsninfo['hostspec'] is set, and if it's not skip adding "host=" to the
connect string.
if ($protocol == 'tcp') {
if ($dsninfo['hostspec']) {
$connstr = 'host=' . $dsninfo['hostspec'];
}
if ($dsninfo['port']) {
$connstr .= ' port=' . $dsninfo['port'];
}
}
I don't know how defaulting protocol to tcp would affect other drivers.
Edin
----- Original Message -----
From: "Tomas V.V.Cox" <cox@idecnet.com>
To: "Edin Kadribasic" <edink@proventum.net>
Cc: "PEAR DEV" <pear-dev@lists.php.net>
Sent: Tuesday, April 09, 2002 6:21 PM
Subject: Re: [PEAR-DEV] Problems with DB in 4.2.0
El mar, 09-04-2002 a las 17:34, Edin Kadribasic escribió:
> I'm using "pgsql://ek:@/ekpops" as pear connect string. This used to work
> until I upgraded to PHP 4.2.0 where this is translated to "host=
> dbname=ekpops user=ek" pgsql connect string. Postgres refuses empy host in
> the connect string.
>
> When looking at the code, I can see that the problem is introduced when
> support for protocol was added to pear connect strings. Hope this doesn't
> make it into PHP 4.2.0 release.
>
Well, is not a really a fail, but it's true we can make a workarround to
it.
I'm going to commit a patch (fallback to localhost if no hostspec is
given).
Tomas V.V.Cox