I have some nightmarish IMAP code which took me an eternity to code. I made it when 7.x was current PHP, and I've been using it to fetch my e-mails into my PHP system for years, without any problems like this.
Yesterday, PHP 8 was finally released as "GA" (stable). I updated. And sure enough, there always has to be some weird issue when updating software. Now, my IMAP code is flooding the logs with this nonsense:
imap_msgno(): Bad message number
Relevant code snippet:
$message_number_array = imap_search($specific_mailbox_connection, 'ALL', SE_UID);
if (count($message_number_array))
{
foreach ($message_number_array as $message_number)
{
$header_info = imap_headerinfo($specific_mailbox_connection, imap_msgno($specific_mailbox_connection, $message_number));
I have double-verified that $message_number_array
is indeed an array of integers and nothing else. And it comes straight from imap_search
. How can these numbers possibly be "bad message numbers"?
Yes, I consistently use UIDs everywhere. Nothing about my code was changed from when it was working perfectly well with PHP 7.4.12 yesterday.
As usual, there's zero relevant information online when I search.
What should I do in this situation and this kind of situation? I don't even understand how this is possible -- let alone how I would fix it.
imap_msgno(): Bad message number
stuff. Not sure if it was called a "notice" or "error", but it was certainly logged in the PHP error log.