Notifications
Clear all

PHP Fatal error and plugin conflict

12 Posts
4 Users
1 Reactions
2,641 Views
(@progressology)
Member Customer
Joined: 6 years ago
Posts: 4
Topic starter  

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
(@astgh)
Illustrious Member Admin
Joined: 7 years ago
Posts: 6199
 

Hi Progressology,

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


   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 7 years ago
Posts: 6199
 

@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)
Member Customer
Joined: 6 years ago
Posts: 4
Topic starter  

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
(@astgh)
Illustrious Member Admin
Joined: 7 years ago
Posts: 6199
 

@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)
Member Customer
Joined: 6 years ago
Posts: 4
Topic starter  

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


   
Karlo reacted
ReplyQuote
(@karlo)
New Member
Joined: 5 years ago
Posts: 4
 

@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 {green}:cool:  

   
ReplyQuote
(@karlo)
New Member
Joined: 5 years ago
Posts: 4
 
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!

{green}:displeased: {green}:serious:  


   
ReplyQuote
(@karlo)
New Member
Joined: 5 years ago
Posts: 4

   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 7 years ago
Posts: 6199
 

@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)
New Member
Joined: 5 years ago
Posts: 4
 

@astghik

{pear}: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)
Support
Joined: 5 years ago
Posts: 1403
 
Posted by: @karlo

Thanks. When can we expect update release?

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


   
ReplyQuote
Share:
Scroll to top