Skip to content

Commit 566b356

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #78980: pgsqlGetNotify() overlooks dead connection
2 parents 5902b35 + f974f25 commit 566b356

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

ext/pdo_pgsql/pgsql_driver.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,13 +1068,21 @@ static PHP_METHOD(PDO, pgsqlGetNotify)
10681068

10691069
H = (pdo_pgsql_db_handle *)dbh->driver_data;
10701070

1071-
PQconsumeInput(H->server);
1071+
if (!PQconsumeInput(H->server)) {
1072+
pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL);
1073+
PDO_HANDLE_DBH_ERR();
1074+
RETURN_FALSE;
1075+
}
10721076
pgsql_notify = PQnotifies(H->server);
10731077

10741078
if (ms_timeout && !pgsql_notify) {
10751079
php_pollfd_for_ms(PQsocket(H->server), PHP_POLLREADABLE, (int)ms_timeout);
10761080

1077-
PQconsumeInput(H->server);
1081+
if (!PQconsumeInput(H->server)) {
1082+
pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL);
1083+
PDO_HANDLE_DBH_ERR();
1084+
RETURN_FALSE;
1085+
}
10781086
pgsql_notify = PQnotifies(H->server);
10791087
}
10801088

0 commit comments

Comments
 (0)