From bcc2f0705d92f39a9936794880453c84088dea88 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 17 Aug 2021 10:33:39 +0200 Subject: [PATCH] Prevent bailout during imap shutdown error reporting This is a non-intrusive, minimal fix for bug #81316, which prevents a bailout during imap RSHUTDOWN and prevents the basic shutdown handler from being skipped. I wasn't able to make the issue reproduce in a small test. --- ext/imap/php_imap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 8e6a3cc77b3..b6e07e7a599 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -1099,7 +1099,9 @@ PHP_RSHUTDOWN_FUNCTION(imap) if (EG(error_reporting) & E_NOTICE) { ecur = IMAPG(imap_errorstack); while (ecur != NIL) { - php_error_docref(NULL, E_NOTICE, "%s (errflg=%ld)", ecur->LTEXT, ecur->errflg); + zend_try { + php_error_docref(NULL, E_NOTICE, "%s (errflg=%ld)", ecur->LTEXT, ecur->errflg); + } zend_end_try(); ecur = ecur->next; } } @@ -1112,7 +1114,9 @@ PHP_RSHUTDOWN_FUNCTION(imap) if (EG(error_reporting) & E_NOTICE) { acur = IMAPG(imap_alertstack); while (acur != NIL) { - php_error_docref(NULL, E_NOTICE, "%s", acur->LTEXT); + zend_try { + php_error_docref(NULL, E_NOTICE, "%s", acur->LTEXT); + } zend_end_try(); acur = acur->next; } }