Notifications
Clear all

PHP Fatal error and plugin conflict  

  RSS

Progressology
(@progressology)
Member Customer
Joined: 1 year ago
Posts: 4
11/04/2019 3:46 am  

Hello –

I am receiving a PHP Fatal error that appears to be interfering with another plugin – Simple History and breaking my site functionality.

Below is the error from the error log. I am hosting with WordPress.com Business hosting and we troubleshot the error and narrowed it down to the wpDiscuz plugin.

PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function wpdFormAttr\Login\SocialLogin::userAvatar(), 5 passed in /wordpress/core/5.1.1/wp-includes/class-wp-hook.php on line 286 and exactly 6 expected in /wpcom-147113777/wp-content/plugins/wpdiscuz/forms/wpdFormAttr/Login/SocialLogin.php:506

I opened a support ticket with Simple History ( https://wordpress.org/support/topic/error-500-wordpress-business-hosting/) but I do not believe that is the root cause of the issue since the PHP error above points to your plugin.

Everything was working fine until today!!!

Any help is appreciated!!! 


Quote
Astghik
(@astghik)
Support Team Admin
Joined: 2 years ago
Posts: 4107
11/04/2019 11:45 am  

Hi Progressology,

Thank you for letting us know. We're going to check the issue. I'll update this topic asap. 


ReplyQuote
Astghik
(@astghik)
Support Team Admin
Joined: 2 years ago
Posts: 4107
11/04/2019 2:02 pm  

@progressology,

The issue comes from the Simple History plugin. wpDiscuz uses WordPress core get_avatar() function. This function has 6 parameters. The plugin also uses this hook and don't pass some of the arguments. 


ReplyQuote
Progressology
(@progressology)
Member Customer
Joined: 1 year ago
Posts: 4
11/04/2019 3:22 pm  

That is not correct according to the Wordpress engineers.  I troubleshot the issue with them and they indicated the error is in your code.  The error in your code is generating a PHP error that is causing conflicts with Wordpress and other plugins.  I’d suggest you investigate further and correct the error in your code as it is causing errors with the Simple History plugin and potentially other plugins as well.


ReplyQuote
Astghik
(@astghik)
Support Team Admin
Joined: 2 years ago
Posts: 4107
11/04/2019 3:54 pm  

@progressology,

this is not a wpDiscuz issue for sure. The plugin doesn't pass all the arguments of the following filter, and it causes the issue. They should check and make sure all those arguments are passed, as all arguments are necessary for wpDiscuz plugin work.

return apply_filters( 'get_avatar', $avatar, $id_or_email, $size, $default, $alt, $args );

ReplyQuote
Progressology
(@progressology)
Member Customer
Joined: 1 year ago
Posts: 4
11/04/2019 3:58 pm  

Ok, I will investigate further and get back to you.


Karlo liked
ReplyQuote
Karlo
(@karlo)
New Member
Joined: 2 months ago
Posts: 4
08/04/2020 11:33 pm  

@astghik

If you change line 506 in SocialLogin.php to

public function userAvatar($avatar, $id_or_email, $size, $default, $alt, $args=array()) {
 
Problem in your plugin will be solved Cool  

ReplyQuote
Karlo
(@karlo)
New Member
Joined: 2 months ago
Posts: 4
28/04/2020 5:05 am  
Posted by: @astghik

@progressology,

this is not a wpDiscuz issue for sure. The plugin doesn't pass all the arguments of the following filter, and it causes the issue. They should check and make sure all those arguments are passed, as all arguments are necessary for wpDiscuz plugin work.

return apply_filters( 'get_avatar', $avatar, $id_or_email, $size, $default, $alt, $args );

This is a wpDiscuz issue for sure! 
Your code REQUIRES OPTIONAL ARGUMENT,
which is, BTW, added in WP 4.2

See here: https://developer.wordpress.org/reference/hooks/get_avatar/

And WP code/docs here
https://core.trac.wordpress.org/browser/tags/5.4/src/wp-includes/pluggable.php#L2608
https://core.trac.wordpress.org/browser/tags/5.4/src/wp-includes/pluggable.php#L2708

So your plugin is screwing up every other plugin which is invoking get_avatar with less than 6 arguments!

Displeased Serious  


ReplyQuote
Karlo
(@karlo)
New Member
Joined: 2 months ago
Posts: 4

ReplyQuote
Astghik
(@astghik)
Support Team Admin
Joined: 2 years ago
Posts: 4107
28/04/2020 3:40 pm  

@karlo,

This is not the wpDiscuz plugin issue for sure. We just use the hook to change avatars we don't need to call a function.

However, we've made some changes in the plugin core and make the sixth parameter non-required to avoid such issues with the other plugins.


ReplyQuote
Karlo
(@karlo)
New Member
Joined: 2 months ago
Posts: 4
28/04/2020 6:57 pm  

@astghik

Smile

Thanks. When can we expect update release?

By the way, calling get_avatar(), from anywhere, without optional parameters is absolutely legitimate WP code.


ReplyQuote
Elvina
(@elvina)
Prominent Member Moderator
Joined: 9 months ago
Posts: 966
29/04/2020 2:46 pm  
Posted by: @karlo

Thanks. When can we expect update release?

I'm sorry but we can't provide any ETA yet.


ReplyQuote
Share: