barbushin / php-imap

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

PHP8.1 imap_open resource //EnsureResource #689

Open trebaxa opened 1 year ago

trebaxa commented 1 year ago

Environment (please complete the following information):

Describe the bug Imap.php failed on line 1073 function "EnsureResource" in PHP8.1, because since PHP8.1 no resource is returned. To Reproduce Switch to PHP8.1

Change the code:

if (!$maybe || (!\is_resource($maybe) && !is_object($maybe) ) ) {

The headers of the parsed email, if required and possible (only, if it's NOT confidential):

Received: from BN3NAM04HT142.eop-NAM04.prod.protection.outlook.com
(2603:10a6:209:2a::30) by AM6PR05MB6294.eurprd05.prod.outlook.com with HTTPS
via AM6PR07CA0017.EURPRD07.PROD.OUTLOOK.COM; Sun, 5 May 2019 12:29:42 +0000
Received: from BN3NAM04FT054.eop-NAM04.prod.protection.outlook.com
(10.152.92.54) by BN3NAM04HT142.eop-NAM04.prod.protection.outlook.com
(10.152.92.244) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1835.13; Sun, 5 May
2019 12:29:41 +0000
...

Expected behavior A clear and concise description of what you expected to happen.

Screenshots / Outputs If applicable, add screenshots or outputs of your script to help explain your problem.

Additional context Add any other context about the problem here.