-
Bug
-
Resolution: Fixed
-
Minor
-
3.0.7-PL1
-
None
-
PHP 5.2.10-2ubuntu6.4 with Suhosin-Patch 0.9.7
PostgreSQL 8.4.2
Currently the postgres database abstraction layer directly passes the boolean value $new_link from dbal::sql_connect to the pg_connect() function.
The manual however says that the second parameter has to be an integer and that the constant PGSQL_CONNECT_FORCE_NEW has to be passed to force a new connection.
http://www.php.net/manual/en/function.pg-connect.php
However, also passing 0 as the second paramater seems to cause problems.
The following tests cause incorrect behaviour on my setup.
var_dump(pg_connect($connect_string, false)); // resource(1, pgsql link)
|
var_dump(pg_connect($connect_string, false)); // resource(1, pgsql link)
|
var_dump(pg_connect($connect_string, true)); // resource(2, pgsql link)
|
var_dump(pg_connect($connect_string, true)); // resource(2, pgsql link) <--
|
var_dump(pg_connect($connect_string, false)); // resource(3, pgsql link) <--
|
var_dump(pg_connect($connect_string, false)); // resource(3, pgsql link)
|
var_dump(pg_connect($connect_string, 0)); // resource(1, pgsql link)
|
var_dump(pg_connect($connect_string, 0)); // resource(1, pgsql link)
|
var_dump(pg_connect($connect_string, PGSQL_CONNECT_FORCE_NEW)); // resource(2, pgsql link)
|
var_dump(pg_connect($connect_string, PGSQL_CONNECT_FORCE_NEW)); // resource(3, pgsql link)
|
var_dump(pg_connect($connect_string, 0)); // resource(4, pgsql link) <--
|
var_dump(pg_connect($connect_string, 0)); // resource(4, pgsql link)
|
The following generated the intended behaviour
var_dump(pg_connect($connect_string)); // resource(1, pgsql link)
|
var_dump(pg_connect($connect_string)); // resource(1, pgsql link)
|
var_dump(pg_connect($connect_string, PGSQL_CONNECT_FORCE_NEW)); // resource(2, pgsql link)
|
var_dump(pg_connect($connect_string, PGSQL_CONNECT_FORCE_NEW)); // resource(3, pgsql link)
|
var_dump(pg_connect($connect_string)); // resource(3, pgsql link)
|
var_dump(pg_connect($connect_string)); // resource(3, pgsql link)
|