easy-digital-downloads
easy-digital-downloads copied to clipboard
3.0 - File download report graph not rendering (undefined array keys).
Bug Report
Expected behavior
I expect to view the report with seeing errors, I see this...
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.
Thanks @davidsherlock I'm in the middle of working on some graphing updates so I'll see if it's related.
I'm not able to replicate this on release/3.0 currently. @robincornett can you verify?
Chris here is how to replicate it:
- Make sure you have only downloaded 1 file in the day.
- Goto the reports > file downloads and set it to "today".
- 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.
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)
I wasn't able to replicate the graph breaking again, but it definitely was happening on a fresh install. Probably some strange edge case...
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.