[php-src] poll-cleanup: pgsql: Use php_pollfd_for_ms in compat shim

Calvin Buckley <[email protected]> Fri, 24 Jul 2026 06:04:43 +0000
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: Calvin Buckley (NattyNarwhal)
Date: 2026-07-24T01:57:47-03:00

Commit: https://github.com/php/php-src/commit/bffd5d855d8aa923d7e9e5eb4995e30b6ce5f420
Raw diff: https://github.com/php/php-src/commit/bffd5d855d8aa923d7e9e5eb4995e30b6ce5f420.diff

pgsql: Use php_pollfd_for_ms in compat shim

This is only used on pre-libpq 17.

Changed paths:
  M  ext/pgsql/pgsql.c


Diff:

diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 0ea766c12b42..ad3061fb529a 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -448,19 +448,14 @@ static int PQsocketPoll(int socket, int read, int write, time_t timeout)
 	if (!read && !write)
 		return 0;
 
-	php_pollfd fd;
-	int ts = -1;
-
-	fd.fd = socket;
-	fd.events = POLLERR;
-	fd.revents = 0;
+	int ts = -1, events = 0;
 
 	if (read) {
-		fd.events |= POLLIN;
+		events |= POLLIN;
 	}
 
 	if (write) {
-		fd.events |= POLLOUT;
+		events |= POLLOUT;
 	}
 
 	if (timeout != (time_t)ts) {
@@ -473,7 +468,7 @@ static int PQsocketPoll(int socket, int read, int write, time_t timeout)
 		}
 	}
 
-	return php_poll2(&fd, 1, ts);
+	return php_pollfd_for_ms(socket, events, ts);
 }
 #endif