Skip to content

Commit b73d8b3

Browse files
committed
Merge branch 'PHP-8.4'
2 parents dcd3ef3 + fd4db3e commit b73d8b3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ext/pgsql/pgsql.c

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

322322
static void _php_pgsql_notice_handler(void *l, const char *message)
323323
{
324+
if (l == NULL) {
325+
/* This connection does not currently have a valid context, ignore this notice */
326+
return;
327+
}
324328
if (PGG(ignore_notices)) {
325329
return;
326330
}
@@ -353,6 +357,11 @@ static int _rollback_transactions(zval *el)
353357

354358
link = (PGconn *) rsrc->ptr;
355359

360+
/* unset notice processor if we initially did set it */
361+
if (PQsetNoticeProcessor(link, NULL, NULL) == _php_pgsql_notice_handler) {
362+
PQsetNoticeProcessor(link, _php_pgsql_notice_handler, NULL);
363+
}
364+
356365
if (PQsetnonblocking(link, 0)) {
357366
php_error_docref("ref.pgsql", E_NOTICE, "Cannot set connection to blocking mode");
358367
return -1;

0 commit comments

Comments
 (0)