Skip to content

Commit 7139c84

Browse files
committed
Fix #19484 by setting the notice processor to a no-op when a persistent connection is cleaned for future use
1 parent a3de2ce commit 7139c84

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ext/pgsql/pgsql.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,10 @@ static void _close_pgsql_plink(zend_resource *rsrc)
328328

329329
static void _php_pgsql_notice_handler(void *l, const char *message)
330330
{
331+
if (l == NULL) {
332+
/* This connection does not currently have a valid context, ignore this notice */
333+
return;
334+
}
331335
if (PGG(ignore_notices)) {
332336
return;
333337
}
@@ -360,6 +364,9 @@ static int _rollback_transactions(zval *el)
360364

361365
link = (PGconn *) rsrc->ptr;
362366

367+
/* unset notice processor */
368+
PQsetNoticeProcessor(link, _php_pgsql_notice_handler, NULL);
369+
363370
if (PQsetnonblocking(link, 0)) {
364371
php_error_docref("ref.pgsql", E_NOTICE, "Cannot set connection to blocking mode");
365372
return -1;

0 commit comments

Comments
 (0)