summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/pgsql/pgsql.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index fe802a28de..bbdec996ca 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -721,6 +721,9 @@ void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
+ if (PQstatus(pgsql) != CONNECTION_OK) {
+ PQreset(pgsql);
+ }
switch(entry_type) {
case PHP_PG_DBNAME:
Z_STRVAL_P(return_value) = PQdb(pgsql);