Skip to content

Commit dcbb008

Browse files
committed
Only set PQsetNoticeProcessor if we did set it to _php_pgsql_notice_handler
1 parent 7139c84 commit dcbb008

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ext/pgsql/pgsql.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,10 @@ static int _rollback_transactions(zval *el)
364364

365365
link = (PGconn *) rsrc->ptr;
366366

367-
/* unset notice processor */
368-
PQsetNoticeProcessor(link, _php_pgsql_notice_handler, NULL);
367+
/* unset notice processor if we initially did set it */
368+
if (PQsetNoticeProcessor(link, NULL, NULL) == _php_pgsql_notice_handler) {
369+
PQsetNoticeProcessor(link, _php_pgsql_notice_handler, NULL);
370+
}
369371

370372
if (PQsetnonblocking(link, 0)) {
371373
php_error_docref("ref.pgsql", E_NOTICE, "Cannot set connection to blocking mode");

0 commit comments

Comments
 (0)