scottopolis / edd-metrics

EDD Metrics
46 stars 12 forks source link

Percent change division by zero warnings #39

Closed pderksen closed 7 years ago

pderksen commented 7 years ago

Not sure what caused this but I noticed some division by zero PHP warnings in my server logs on my production site from yesterday (running v0.5.0). Example:

[Mon Oct 10 16:41:20.579279 2016] [:error] [pid 7810] [client 209.136.228.130:20256] PHP Warning: Division by zero in .../wp-content/plugins/edd-metrics/includes/class-edd-metrics-functions.php on line 392, referer: .../wp-admin/edit.php?post_type=download&page=edd_metrics

Somehow the $old_val passed in here was zero?

https://github.com/scottopolis/edd-metrics/blob/e476ff2efaa938c7eb97936d4b551eb314a4842d/includes/class-edd-metrics-functions.php#L383-L393

Sorry I can't narrow it down more than that right now.

scottopolis commented 7 years ago

Should hopefully fix ecefd29df3a65bc3383b3344aba68d6ad84fd475