easy-digital-downloads icon indicating copy to clipboard operation
easy-digital-downloads copied to clipboard

3.0 - File download report graph not rendering (undefined array keys).

Open arraypress opened this issue 3 years ago • 6 comments
trafficstars

Bug Report

Expected behavior

I expect to view the report with seeing errors, I see this...

Screenshot 2022-06-23 at 00 47 23

The warnings I see are as follows:

Warning Undefined array key 1655856000 1 +wp-content/plugins/easy-digital-downloads-release-3.0/includes/admin/reporting/reports.php:2013 Plugin: easy-digital-downloads-release-3.0
Warning Undefined array key 1 1 +wp-content/plugins/easy-digital-downloads-release-3.0/includes/admin/reporting/reports.php:2013 Plugin: easy-digital-downloads-release-3.0
Warning Undefined array key 0 1 +wp-content/plugins/easy-digital-downloads-release-3.0/includes/reports/data/charts/v2/class-dataset.php:265 Plugin: easy-digital-downloads-release-3.0

Using latest 3.0 branch.

I believe this is related to the other issue I posted regarding the assumptions on those array elements.

arraypress avatar Jun 22 '22 21:06 arraypress

Thanks @davidsherlock I'm in the middle of working on some graphing updates so I'll see if it's related.

cklosowski avatar Jun 28 '22 16:06 cklosowski

I'm not able to replicate this on release/3.0 currently. @robincornett can you verify?

cklosowski avatar Jun 29 '22 07:06 cklosowski

Chris here is how to replicate it:

  1. Make sure you have only downloaded 1 file in the day.
  2. Goto the reports > file downloads and set it to "today".
  3. You will see this warning: "

( ! ) Warning: Undefined property: stdClass::$day in /wp-content/plugins/easy-digital-downloads-release-3.0/includes/admin/reporting/reports.php on line 1881"

The graph does display, but this warning flags up.

arraypress avatar Jun 29 '22 11:06 arraypress

Thanks for the instructions, @davidsherlock, that's helpful. Interestingly, I get the property errors, but not array key errors:

PHP Notice:  Undefined property: stdClass::$day in C:\Users\robin\Documents\websites\edd\app\public\wp-content\plugins\easy-digital-downloads.30\includes\admin\reporting\reports.php on line 1884
 PHP Notice:  Undefined property: stdClass::$hour in C:\Users\robin\Documents\websites\edd\app\public\wp-content\plugins\easy-digital-downloads.30\includes\admin\reporting\reports.php on line 1884

Dumping the $result shows that those properties don't exist:

object(stdClass)[3111]
  public 'total' => string '1' (length=1)
  public 'year' => string '2022' (length=4)
  public 'month' => string '6' (length=1)

robincornett avatar Jun 29 '22 13:06 robincornett

I wasn't able to replicate the graph breaking again, but it definitely was happening on a fresh install. Probably some strange edge case...

arraypress avatar Jun 29 '22 14:06 arraypress

I'll work through this one, I'm still seeing the notices and I have an idea why it's happening, will fix it in a branch that is already working to resolve issues like this.

cklosowski avatar Jun 30 '22 18:06 cklosowski