Skip to:
Content

BuddyPress.org

Opened 12 years ago

Closed 12 years ago

#5025 closed defect (bug) (fixed)

BUG? bp_the_body_class missing parameter

Reported by: tivnet's profile tivnet Owned by: boonebgorges's profile boonebgorges
Milestone: 1.8 Priority: lowest
Severity: trivial Version: 1.7
Component: Core Keywords: needs-patch
Cc:

Description

This piece of code looks incorrect. $wp_classes does not have a default value, so the call bp_get_the_body_class(); should produce at least a warning.

function bp_the_body_class() {
	echo bp_get_the_body_class();
}
	function bp_get_the_body_class( $wp_classes, $custom_classes = false ) {

Change History (2)

#1 @boonebgorges
12 years ago

  • Milestone changed from Awaiting Review to 1.8
  • Priority changed from normal to lowest
  • Severity changed from normal to trivial

I'm not sure why we have a function bp_the_body_class() in the first place - the _get_ version should be all we need, since it filters another value, and is not meant to be called directly. In any case, you're current that we should either have a default value, or in bp_the_body_class() we should be passing a value for the first param.

#2 @boonebgorges
12 years ago

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

In 7113:

Pass a default value to the first param of bp_get_the_body_class()

When bp_get_the_body_class() is run as a filter on 'body_class', the first
param is never empty. However, if you call the function directly, or in
particular if you call the echo wrapper bp_the_body_class(), you will get a
PHP error due to the fact that no default value for the function has been
provided. This changeset prevents any such errors.

Fixes #5025

Props tivnet

Note: See TracTickets for help on using tickets.