File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -321,6 +321,10 @@ static void _close_pgsql_plink(zend_resource *rsrc)
321321
322322static 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 ;
You can’t perform that action at this time.
0 commit comments