Skip to:
Content

bbPress.org

Opened 9 months ago

Last modified 4 weeks ago

#3428 assigned defect (bug)

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 (2)

issue on frontend.png (406.9 KB) - added by hasanuzzamanshamim 7 weeks ago.
Issue screenshot
3428.diff (1.2 KB) - added by hasanuzzamanshamim 7 weeks ago.
Patch created for validation

Download all attachments as: .zip

Change History (6)

#1 @createquest
3 months ago

I fixed this by wrapping the topic count like so.

<?php if(isset($stats['topic_tag_count'])) : ?>
    <dt><?php esc_html_e( 'Topic Tags', 'createquest' ); ?></dt>
      <dd>
	<strong>
	<?php echo esc_html( $stats['topic_tag_count'] ); ?>
	</strong>
     </dd>
<?php endif; ?>

The same is repeated throughout the same file by using empty() instead of isset().

#2 @johnjamesjacoby
7 weeks 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

@hasanuzzamanshamim
7 weeks ago

Issue screenshot

@hasanuzzamanshamim
7 weeks ago

Patch created for validation

#3 @hasanuzzamanshamim
7 weeks ago

  • Keywords has-patch added; needs-patch removed

#4 @hasanuzzamanshamim
4 weeks 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
Note: See TracTickets for help on using tickets.