WordPress Version: 4.9.8
Note that the below happens only in PHP version 7.2.11 and in 7.0.32 it works fine!
password_reset action is suppose to call function with 2 arguments but I am getting this:
PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function changeServerPassword(), 1 passed in /home/hm/public_html/wp-includes/class-wp-hook.php on line 288 and exactly 2 expected in /home/hm/public_html/wp-content/plugins/[path].php:9, referer: .php?action=rp
So for some reason, it looks like WP is calling my function with only 1 argument. Any idea why this is happening? Following is a sample code that I am using:
add_action('password_reset', Array(new className(), "changeServerPassword"));
Inside the class className:
// $pass is not passed by wordpress and so it results in the above error
public function changeServerPassword($user, $pass) {
// do things here
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745322990a4622527.html
评论列表(0条)