Looks like as this has been forgotten when adding PHP 8.1 support in the past.
Solves #655.
Tested with different PHP major versions and the identical code: All versions were able to get the same emails incl. attachments and it always took around 10 seconds for 25 emails.
$ /c/PHP/7.3.12-nts/php.exe testing.php
Trying to connect to '{outlook.office365.com:993/imap/ssl}INBOX'...
Found 25 email(s)...
Total attachments: 26
time for getting mail Is: 9.846657037735 sec.
$ /c/PHP/7.4.26-nts/php.exe testing.php
Trying to connect to '{outlook.office365.com:993/imap/ssl}INBOX'...
Found 25 email(s)...
Total attachments: 26
time for getting mail Is: 10.306457996368 sec.
$ /c/PHP/8.0.13-nts/php.exe testing.php
Trying to connect to '{outlook.office365.com:993/imap/ssl}INBOX'...
Found 25 email(s)...
Total attachments: 26
time for getting mail Is: 9.220538854599 sec.
$ /c/PHP/8.1.0-nts/php.exe testing.php
Trying to connect to '{outlook.office365.com:993/imap/ssl}INBOX'...
Found 25 email(s)...
Total attachments: 26
time for getting mail Is: 9.7392268180847 sec.
IMAP stream can be an IMAP resource or IMAP\Connection object. See https://www.php.net/manual/en/migration81.incompatible.php for further information.
Looks like as this has been forgotten when adding PHP 8.1 support in the past.
Solves #655.
Tested with different PHP major versions and the identical code: All versions were able to get the same emails incl. attachments and it always took around 10 seconds for 25 emails.