Skip to content

Commit aae88ac

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: ext/pgsql: Fix warning not being emittedd when failure to cancel a query
2 parents 9e9db0b + 40422e9 commit aae88ac

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ PHP NEWS
2121
. Add missing filter cleanups on phar failure. (nielsdos)
2222
. Fixed bug GH-18642 (Signed integer overflow in ext/phar fseek). (nielsdos)
2323

24+
- PGSQL:
25+
. Fix warning not being emitted when failure to cancel a query with
26+
pg_cancel_query(). (Girgias)
27+
2428
- Readline:
2529
. Fix memory leak when calloc() fails in php_readline_completion_cb().
2630
(nielsdos)

ext/pgsql/pgsql.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3843,8 +3843,14 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
38433843
int rc;
38443844

38453845
c = PQgetCancel(pgsql);
3846+
/* PQcancel
3847+
* The return value of PQcancel is 1 if the cancel request was successfully dispatched and 0 if not.
3848+
* If not, errbuf is filled with an explanatory error message.
3849+
* errbuf must be a char array of size errbufsize (the recommended size is 256 bytes).
3850+
* https://www.postgresql.org/docs/current/libpq-cancel.html#LIBPQ-PQCANCEL
3851+
*/
38463852
RETVAL_LONG((rc = PQcancel(c, err, sizeof(err))));
3847-
if (rc < 0) {
3853+
if (rc == 0) {
38483854
zend_error(E_WARNING, "cannot cancel the query: %s", err);
38493855
}
38503856
while ((pgsql_result = PQgetResult(pgsql))) {

0 commit comments

Comments
 (0)