Skip to:

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#2030 closed defect (bug) (fixed)

call_user_func_array() expects parameter 1 to be a valid callback, non-static method BBP_Replies_Widget::register_widget() should not be called statically

Reported by: nerrad's profile nerrad Owned by:
Milestone: 2.2 Priority: normal
Severity: normal Version: trunk
Component: API - Widgets Keywords: has-patch
Cc: nerrad


Getting the above notice on our bbPress site running PHP 5.3.18

Stack trace:

…ll_user_func_array called at /public_html/wp-includes/plugin.php (403)

…ntesp/public_html/wp-content/plugins/bbpress/bbp-includes/bbp-core-actions.php (402)

in bbp_widgets_init called at ? (?)
…ll_user_func_array called at /public_html/wp-includes/plugin.php (403)

…do_action called at /public_html/wp-includes/default-widgets.php (1181)

in wp_widgets_init called at ? (?)
…ll_user_func_array called at /public_html/wp-includes/plugin.php (403)

in do_action called at /public_html/wp-settings.php (302)

in require_once called at /public_html/wp-config.php (134)

in require_once called at /public_html/wp-load.php (29)

in require_once called at /public_html/wp-blog-header.php (12)

in require called at /public_html/index.php (17)

Attachments (1)

2030.001.patch (1.1 KB) - added by nerrad 10 years ago.
add static keyword to register_widget methods

Download all attachments as: .zip

Change History (8)

#1 @nerrad
10 years ago

looks like this applies to all bbPress widget calls. Would be better to declare all register_widget methods in the extended widgets as "static"?

10 years ago

add static keyword to register_widget methods

#2 @nerrad
10 years ago

  • Keywords has-patch added; needs-patch removed

Added patch

#3 @nerrad
10 years ago

  • Component changed from Warnings/Notices to Widgets

#4 @nerrad
10 years ago

  • Cc nerrad added
  • Version changed from 2.1.2 to trunk

#5 @johnjamesjacoby
10 years ago

  • Milestone changed from Awaiting Review to 2.2

Good catch. Haven't looked into why this isn't an issue for me on PHP5.4.

Moving to 2.2, as it's an easy fix.

#6 @johnjamesjacoby
10 years ago

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

(In [4432]) Widgets:

  • Declare widget() methods as static.
  • Fixes PHP notices for static method usages.
  • Fixes #2030.

#7 @johnjamesjacoby
10 years ago

Props nerrad. Sorry I missed you in the commit message!

Note: See TracTickets for help on using tickets.