Static Methods need updating
-
I’m getting the warning below because my dev server error reporting is set to E_ALL, but this sometimes helps with feedback to the developers of the plugins I use.
Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method bannerspace_plugin_options::update() should not be called statically in /media/DriveD/sdb1/www/www.website.dev/wp-includes/plugin.php on line 470
Strict Standards: Non-static method bannerspace_plugin_options::BS_getOptions() should not be called statically in /media/DriveD/sdb1/www/www.website.dev/wp-content/plugins/bannerspace/bannerspace.php on line 124
You may need to update the function call from the class.
I.E.
class myClass { public function helloWorld() { echo "Hello, World!"; } } $example = new myClass(); call_user_func(array($example, 'helloWorld'));
Not sure, I believe the issue may actually occur on line 315
// register functions add_action('admin_menu', array('bannerspace_plugin_options', 'update'));
You are calling the function directly in the add action without creating the class? But then the add_action should be also declared in the construct method of the class:
Please see here about this:
https://codex.www.ads-software.com/Function_Reference/add_actionpublic function __construct() { //add your actions to the constructor! add_action( 'admin_menu', array( $this, 'update' ) ); }
As I say this is not a problem on as is a warning but you may want to consider fixing it.
thanks
Andi
- The topic ‘Static Methods need updating’ is closed to new replies.