#3428 closed defect (bug) (fixed)
Statistics widget throws Undefined index if no replies or topics tags
Reported by: | Robin W | Owned by: | johnjamesjacoby |
---|---|---|---|
Milestone: | 2.6.10 | Priority: | low |
Severity: | minor | Version: | |
Component: | General - Administration | Keywords: | has-patch |
Cc: |
Description
If you create a new install with just one forum and one topic and no replies and add the statistics widget to the widget area then in the front of the website you get these notifications.
Notice: Undefined index: reply_count in /var/docs/server.tst/public/wp-content/plugins/bbpress/templates/default/bbpress/content-statistics.php on line 37
Notice: Undefined index: topic_tag_count in /var/docs/server.tst/public/wp-content/plugins/bbpress/templates/default/bbpress/content-statistics.php on line <i>42
Attachments (4)
Change History (11)
#2
@
3 years ago
- Component changed from General to General - Administration
- Keywords needs-patch added
- Milestone changed from Awaiting Review to 2.6.10
- Owner set to johnjamesjacoby
- Status changed from new to assigned
#4
@
3 years ago
- Summary changed from Statistics widget throws Undefined index if no relies or topics tags to Statistics widget throws Undefined index if no replies or topics tags
#5
@
3 years ago
3428.02.patch takes a slightly different approach:
- Remove the
array_filter()
call on the return value ofbbp_get_statistics()
to ensure most keys are always set - Relatedly, adds a class to the statistics
dl
element to make it easier/possible to style
I fixed this by wrapping the topic count like so.
The same is repeated throughout the same file by using empty() instead of isset().