Merge branch 'PHP-8.4'

* PHP-8.4:
  ext/pgsql: Fix warning not being emittedd when failure to cancel a query
This commit is contained in:
Gina Peter Banyard 2025-05-29 15:44:08 +01:00
commit 2b22ea9630
No known key found for this signature in database
GPG key ID: F30F8C1ACF51943F

View file

@ -3887,8 +3887,14 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
int rc; int rc;
c = PQgetCancel(pgsql); c = PQgetCancel(pgsql);
/* PQcancel
* The return value of PQcancel is 1 if the cancel request was successfully dispatched and 0 if not.
* If not, errbuf is filled with an explanatory error message.
* errbuf must be a char array of size errbufsize (the recommended size is 256 bytes).
* https://www.postgresql.org/docs/current/libpq-cancel.html#LIBPQ-PQCANCEL
*/
RETVAL_LONG((rc = PQcancel(c, err, sizeof(err)))); RETVAL_LONG((rc = PQcancel(c, err, sizeof(err))));
if (rc < 0) { if (rc == 0) {
zend_error(E_WARNING, "cannot cancel the query: %s", err); zend_error(E_WARNING, "cannot cancel the query: %s", err);
} }
while ((pgsql_result = PQgetResult(pgsql))) { while ((pgsql_result = PQgetResult(pgsql))) {