Skip to:
Content

bbPress.org

Opened 6 months ago

Closed 6 months ago

Last modified 6 months ago

#3644 closed defect (bug) (fixed)

Private/Hidden enforcer functions may trigger PHP warnings

Reported by: johnjamesjacoby's profile johnjamesjacoby Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.0
Component: Component - Forums Keywords: commit
Cc:

Description

Seeing this in some logs:

E_WARNING: Attempt to read property "ID" on null in `wp-content/plugins/bbpress/includes/forums/functions.php:2481

After a bit of research, it's because of an intentionally loose is_singular() check in both bbp_forum_enforce_private() and bbp_forum_enforce_hidden() when weird query variables are requested that just happen to match a bbPress post type.

Change History (2)

#1 @johnjamesjacoby
6 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 7341:

Forums: prevent PHP warnings on singular bbPress pages when post ID's are not set.

This change adds checks for empty $wp_query->post->ID before using it inside of bbp_forum_enforce_private() and bbp_forum_enforce_hidden().

In trunk, for 2.7.

Fixes #3644.

#2 @johnjamesjacoby
6 months ago

In 7342:

Forums: prevent PHP warnings on singular bbPress pages when post ID's are not set.

This change adds checks for empty $wp_query->post->ID before using it inside of bbp_forum_enforce_private() and bbp_forum_enforce_hidden().

In branches/2.6, for 2.6.15.

Fixes #3644.

Note: See TracTickets for help on using tickets.