password - Function called by password_reset action passed only 1 argument instead of 2 in PHP 7.2.11

WordPress Version: 4.9.8Note that the below happens only in PHP version 7.2.11 and in 7.0.32 it works fine!password_rese

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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信