userjack6880 / Open-DMARC-Analyzer

Open DMARC Analyzer is an Open Source DMARC Report Analyzer to be used with DMARC reports that have been parsed by John Levine's rrdmarc script or techsneeze's dmarcts-report-parser.
GNU General Public License v3.0
217 stars 23 forks source link

[Bug]: Division by zero #68

Closed jadethaveekij closed 1 year ago

jadethaveekij commented 1 year ago

At certain times (certain weeks), it seemed that there is this error. Not sure if this is related to the data part?

Warning: Division by zero in /var/web/mrtg/dmarc/Open-DMARC-Analyzer/includes/template.php on line 280 Warning: Division by zero in /var/web/mrtg/dmarc/Open-DMARC-Analyzer/includes/template.php on line 281 Warning: Division by zero in /var/web/mrtg/dmarc/Open-DMARC-Analyzer/includes/template.php on line 282 Warning: Division by zero in /var/web/mrtg/dmarc/Open-DMARC-Analyzer/includes/template.php on line 283 Warning: Division by zero in /var/web/mrtg/dmarc/Open-DMARC-Analyzer/includes/template.php on line 284

Somewhere along this

// stat calculations $dmarc_comp_pct = number_format(100 ($dmarc_comp / $dmarc_none)); $dkim_comp_pct = number_format(100 ($dkim_pass_aligned / $dmarc_none)); $dkim_pass_pct = number_format(100 (($dkim_pass_aligned + $dkim_pass_noalign) / $dmarc_none)); $spf_comp_pct = number_format(100 ($spf_pass_aligned / $dmarc_none)); $spf_pass_pct = number_format(100 * (($spf_pass_aligned + $spf_pass_noalign) / $dmarc_none));

2022-11-08 17_11_26-Open DMARC Analyzer - Dashboard and 2 more pages - Personal - Microsoft​ Edge

Screenshots If applicable, add screenshots to help explain your problem.

Software Version 1-fc upgraded from 0-α7.1

userjack6880 commented 1 year ago

Seems to be a case where if there are 0 accepted emails, it literally is trying to divide by zero. It'll get addressed in the next update. I'll leave this open until it's addressed.

jadethaveekij commented 1 year ago

yes, this is some old, legacy domains which we need to only keep a few mails for delivery -- and it was marked as a subdomains so it's mostly ... spamtraped domains T__T" sorry for the troubles. so, we get around by changing from 1w to 1m timeframe which gives ample more good result. :D

userjack6880 commented 1 year ago

Can you give the version in the dev branch a try and see if this solves your issue? It should be a straightforward upgrade from 1-fc.

jadethaveekij commented 1 year ago

Confirmed that the reported issue is now fixed. THANK YOU. ==/|\==

Below two screenshots are based on the same data range -- I had to change the date range much shorter (1d) to view/find the issue.

before: image

after: image

userjack6880 commented 1 year ago

Exactly what I like to hear. Thanks!