barbushin / php-imap

Manage mailboxes, filter/get/delete emails in PHP (supports IMAP/POP3/NNTP)
MIT License
1.65k stars 459 forks source link

#655: Add missing PHP 8.1 support #656

Closed Sebbo94BY closed 2 years ago

Sebbo94BY commented 2 years ago

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.

$ /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.