Skip to:
Content

BuddyPress.org

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#6324 closed defect (bug) (no action required)

Debug notices when extending BP_Component

Reported by: henrywright's profile henry.wright Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Core Keywords:
Cc:

Description

I'm getting a few debug notices when trying to extend BP_Component

To check it wasn't me doing something wrong, I installed the BP Skeleton Component and got the same. I've pasted below the notices I get on activation of that plugin:

Strict Standards: Declaration of BP_Example_Component::setup_globals() should be compatible with BP_Component::setup_globals($args = Array) in /wp-content/plugins/buddypress-skeleton-component/includes/bp-example-loader.php on line 362

Strict Standards: Declaration of BP_Example_Component::includes() should be compatible with BP_Component::includes($includes = Array) in /wp-content/plugins/buddypress-skeleton-component/includes/bp-example-loader.php on line 362

Strict Standards: Declaration of BP_Example_Component::setup_nav() should be compatible with BP_Component::setup_nav($main_nav = Array, $sub_nav = Array) in /wp-content/plugins/buddypress-skeleton-component/includes/bp-example-loader.php on line 362

As an aside, I also get these notices when activating the Skeleton Component (although I'm not sure if they're related to extending BP_Component) so they may need another ticket.

Warning: Cannot modify header information - headers already sent by (output started at /wp-content/plugins/buddypress-skeleton-component/includes/bp-example-loader.php:362) in /wp-includes/pluggable.php on line 1178

Warning: Cannot modify header information - headers already sent by (output started at /wp-content/plugins/buddypress-skeleton-component/includes/bp-example-loader.php:362) in /wp-includes/option.php on line 748

Warning: Cannot modify header information - headers already sent by (output started at /wp-content/plugins/buddypress-skeleton-component/includes/bp-example-loader.php:362) in /wp-includes/option.php on line 749

Change History (5)

#1 @sbrajesh
9 years ago

The error is not related to BP_Component class.
it is related to how that class was extended.
If you see the above message, you are on php 5.4 or above.

You just need to use the proper method signature while overriding a method from parent class.
For example, in setup_global, changing signature to

public function setup_globals( $args = array() )

will fix the error.

Make sure to follow the method signatures from the BP_Component class while extending it and there will be no error.

#2 @boonebgorges
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

As sbrajesh notes, this is not a BP bug. It should be fixed in buddypress-skeleton-component and in other plugins.

#3 @henry.wright
9 years ago

Thanks for the info @sbrajesh and @boonebgorges.

#4 @henry.wright
9 years ago

@boonebgorges

I did some investigating into the second set of notices. For the record, they're completely unrelated to BuddyPress Skeleton Component.

Thanks again @sbrajesh for letting me know 5.4 is fussy about the method signature when overriding.

#5 @DJPaul
8 years ago

  • Component changed from API to Core
Note: See TracTickets for help on using tickets.