summaryrefslogtreecommitdiff
path: root/ext/pdo_pgsql/pgsql_driver.c
diff options
context:
space:
mode:
authorSATO Kentaro <kentaro@ranvis.com>2019-12-18 02:36:03 +0900
committerNikita Popov <nikita.ppv@gmail.com>2019-12-20 12:05:17 +0100
commit37d11d123e4b8952bf973e372c4062f6d0a7bca8 (patch)
tree265db3f3ae02c794e8278a38ec2735e472c6d1c7 /ext/pdo_pgsql/pgsql_driver.c
parent7e39e6934d7eb3f480a467de7d9fbca608fc1e94 (diff)
downloadphp-git-37d11d123e4b8952bf973e372c4062f6d0a7bca8.tar.gz
Fix #78982: pdo_pgsql returns dead persistent connection
Call PQconsumeInput() before PQstatus() to update the status.
Diffstat (limited to 'ext/pdo_pgsql/pgsql_driver.c')
-rw-r--r--ext/pdo_pgsql/pgsql_driver.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
index 1be0a6146e..89dd55167e 100644
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ b/ext/pdo_pgsql/pgsql_driver.c
@@ -479,7 +479,7 @@ static int pdo_pgsql_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *return_
static int pdo_pgsql_check_liveness(pdo_dbh_t *dbh)
{
pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
- if (PQstatus(H->server) == CONNECTION_BAD) {
+ if (!PQconsumeInput(H->server) || PQstatus(H->server) == CONNECTION_BAD) {
PQreset(H->server);
}
return (PQstatus(H->server) == CONNECTION_OK) ? SUCCESS : FAILURE;