Skip to:
Content

bbPress.org

Opened 8 years ago

Closed 8 years ago

#3059 closed enhancement (fixed)

Non-numeric value issue

Reported by: padrenola's profile padrenola Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.6 Priority: normal
Severity: major Version:
Component: Tools - Code Improvements Keywords: commit
Cc:

Description

Version 2.6-beta-2

“Warning: A non-numeric value encountered in . . . /wp-content/plugins/bbpress/includes/forums/template.php on line 1441”

Here is line 1441 $retval = $replies + $topics;

http://www.sndg.org/2017/forums/

This kind of thing is out of my knowledge base. Is it something I did, or a bad line in the install?

Change History (14)

#1 @padrenola
8 years ago

I am using 2.6-beta-2 because the 2.6 version that is promoted in my X Theme bundle lacks any functional links/tabs in the WordPress Dashboard after install.
X Theme version 4.6.4
WordPress version 4.7.2

#2 @johnjamesjacoby
8 years ago

There are improvements to make here, but... bbp_get_forum_topic_count() should always at least return an int value, and it appears like it works correctly in all cases.

I looked at _bbp_total_reply_count and _bbp_total_topic_count meta-data updates, and everything gets stored as an integer, so there isn't a case where a number-formatted value is getting passed around.

#3 @johnjamesjacoby
8 years ago

In 6289:

Queries: Return empty array if no parent ID or no post-type are passed.

See #3059.

#4 @johnjamesjacoby
8 years ago

  • Component changed from Tools - Warnings/Notices to Tools - Code Improvements
  • Keywords commit added
  • Milestone changed from Awaiting Review to 2.6
  • Priority changed from high to normal
  • Type changed from defect to enhancement

#5 @johnjamesjacoby
8 years ago

In 6296:

Meta: Filter _count_int and enforce integer values.

Also use convenience functions for forum post counts, to ensure proper filters are ran against all meta values.

See #3059.

#6 @johnjamesjacoby
8 years ago

In 6297:

Meta: Missed bbp_get_user_topic_count_int in r6296.

Props @thebrandonallen. See #3059.

#7 @netweb
8 years ago

Anything else to do here before marking as fixed?

#8 @padrenola
8 years ago

I wish any of the above made sense to me. What I know is that I still have the same problem.
http://www.sndg.org/2017/forums/ please see warning on this page.

#9 @johnjamesjacoby
8 years ago

@padrenola We haven't pushed any updated beta releases yet. Are you keeping up with trunk on your own? If so, it might be easiest if I could somehow see your installation directly (if you're comfortable with that.)

This ticket was mentioned in Slack in #bbpress by thebrandonallen. View the logs.


8 years ago

#11 @thebrandonallen
8 years ago

@padrenola The issue you are seeing is related to how X Theme adds styling to forum topic|reply|post counts. They are filtering on all iterations of bbp_get_forum_{type}_count and bbp_get_forum_{type}_count_int, and returning the count wrapped in a span element.

This is fine for the non-integer counts, but causes the issue you are seeing when applying the same logic to the filters with the _int suffix.

#12 @johnjamesjacoby
8 years ago

In 6301:

Common: Switch from absint() to intval() to avoid integer inaccuracies.

See #3059.

#13 @johnjamesjacoby
8 years ago

In 6302:

Common: Introduce bbp_number_not_negative() and use it in the following ways:

  • Register the relevant meta-data keys for posts & users, so updated values can never be invalid
  • Filter return values for existing database values that might be invalid on existing installs
  • Use in place of intval() or (int) casts where negative values should not exist

This has the added benefit of introducing the bbp_register_meta hook, for future meta-data registrations (of which bbPress has much of.) We'll concentrate on counts for 2.6, and integrate IDs and timestamps in future releases.

See #3059.

#14 @johnjamesjacoby
8 years ago

  • Owner set to johnjamesjacoby
  • Resolution set to fixed
  • Status changed from new to closed

In 6303:

Hidden: Remove "+ " string portion from output from hidden content.

This is a carry-over from bbPress 0.x, is superfluous in the given context, and previously could have presented misleading results if a negative value was presented.

Fixes #3059.

Note: See TracTickets for help on using tickets.