Fix maybe-uninitialized warning

Some GCC versions don't like zend_try in loop. Avoid the issue
by pulling it out of the loop, we don't particularly care about
skipping further warnings if a bailout occurs, just that it
does not interrupt shutdown.

Closes GH-7380.
This commit is contained in:
Nikita Popov 2021-08-17 11:26:51 +02:00
parent e45a063f4b
commit b66168e86b

View File

@ -657,13 +657,13 @@ PHP_RSHUTDOWN_FUNCTION(imap)
if (IMAPG(imap_errorstack) != NIL) { if (IMAPG(imap_errorstack) != NIL) {
/* output any remaining errors at their original error level */ /* output any remaining errors at their original error level */
if (EG(error_reporting) & E_NOTICE) { if (EG(error_reporting) & E_NOTICE) {
ecur = IMAPG(imap_errorstack); zend_try {
while (ecur != NIL) { ecur = IMAPG(imap_errorstack);
zend_try { while (ecur != NIL) {
php_error_docref(NULL, E_NOTICE, "%s (errflg=%ld)", ecur->LTEXT, ecur->errflg); php_error_docref(NULL, E_NOTICE, "%s (errflg=%ld)", ecur->LTEXT, ecur->errflg);
} zend_end_try(); ecur = ecur->next;
ecur = ecur->next; }
} } zend_end_try();
} }
mail_free_errorlist(&IMAPG(imap_errorstack)); mail_free_errorlist(&IMAPG(imap_errorstack));
IMAPG(imap_errorstack) = NIL; IMAPG(imap_errorstack) = NIL;
@ -672,13 +672,13 @@ PHP_RSHUTDOWN_FUNCTION(imap)
if (IMAPG(imap_alertstack) != NIL) { if (IMAPG(imap_alertstack) != NIL) {
/* output any remaining alerts at E_NOTICE level */ /* output any remaining alerts at E_NOTICE level */
if (EG(error_reporting) & E_NOTICE) { if (EG(error_reporting) & E_NOTICE) {
acur = IMAPG(imap_alertstack); zend_try {
while (acur != NIL) { acur = IMAPG(imap_alertstack);
zend_try { while (acur != NIL) {
php_error_docref(NULL, E_NOTICE, "%s", acur->LTEXT); php_error_docref(NULL, E_NOTICE, "%s", acur->LTEXT);
} zend_end_try(); acur = acur->next;
acur = acur->next; }
} } zend_end_try();
} }
mail_free_stringlist(&IMAPG(imap_alertstack)); mail_free_stringlist(&IMAPG(imap_alertstack));
IMAPG(imap_alertstack) = NIL; IMAPG(imap_alertstack) = NIL;