File tree 1 file changed +19
-2
lines changed
1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -3470,12 +3470,29 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
3470
3470
PQconsumeInput (pgsql );
3471
3471
RETVAL_LONG (PQisBusy (pgsql ));
3472
3472
break ;
3473
- case PHP_PG_ASYNC_REQUEST_CANCEL :
3474
- RETVAL_LONG (PQrequestCancel (pgsql ));
3473
+ case PHP_PG_ASYNC_REQUEST_CANCEL : {
3474
+ PGcancel * c ;
3475
+ char err [256 ];
3476
+ int rc ;
3477
+
3478
+ c = PQgetCancel (pgsql );
3479
+
3480
+ if (!c ) {
3481
+ // only possible reason since the connection is already verified at that point
3482
+ zend_error (E_WARNING , "can't allocate a cancel procedure" );
3483
+ RETURN_FALSE ;
3484
+ }
3485
+
3486
+ RETVAL_LONG ((rc = PQcancel (c , err , sizeof (err ))));
3487
+ if (rc < 0 ) {
3488
+ zend_error (E_WARNING , "can't cancel the query: %s" , err );
3489
+ }
3475
3490
while ((pgsql_result = PQgetResult (pgsql ))) {
3476
3491
PQclear (pgsql_result );
3477
3492
}
3493
+ PQfreeCancel (c );
3478
3494
break ;
3495
+ }
3479
3496
EMPTY_SWITCH_DEFAULT_CASE ()
3480
3497
}
3481
3498
if (PQsetnonblocking (pgsql , 0 )) {
You can’t perform that action at this time.
0 commit comments