liuch / dmarc-srg

A php parser, viewer and summary report generator for incoming DMARC reports.
GNU General Public License v3.0
218 stars 32 forks source link

PHP Fatal Error on connection error #37

Closed smeinecke closed 1 year ago

smeinecke commented 1 year ago

Just spotted this mail from my cron. The connection error itself was a problem by my mailserver, but that Fatal error seems to be some kind of bug.

Can't connect to mx.mydomain.de,993: No route to host
PHP Fatal error:  Uncaught TypeError: imap_close(): Argument #1 ($imap) must be of type IMAP\Connection, bool given in /var/customers/webs/mydomain/dmarc-view.mydomain.de/classes/Mail/MailBox.php:87
Stack trace:
#0 /var/customers/webs/mydomain/dmarc-view.mydomain.de/classes/Mail/MailBox.php(87): imap_close()
#1 [internal function]: Liuch\DmarcSrg\Mail\MailBox->__destruct()
#2 {main}
  thrown in /var/customers/webs/mydomain/dmarc-view.mydomain.de/classes/Mail/MailBox.php on line 87

Will check this tomorrow.

liuch commented 1 year ago

I just fixed it here: https://github.com/liuch/dmarc-srg/commit/08366ec0523eedaebdbd6220a62d0e1bde9923f9. Could you check it out?

smeinecke commented 1 year ago

Wow, that was fast :+1: will try it later, thanks.

smeinecke commented 1 year ago

I just triggered the connection problem and the fatal error is gone, so this is fixed, thanks :)