wpDiscuz - WordPress Comment Plugin
Missing argument in...
 
Share:
Notifications
Clear all

Missing argument in _getWPComments causes wrong comments in combiation with redis plugins


BenK
Posts: 2
 BenK
Topic starter
(@benk)
New Member
Joined: 5 months ago

Hello,

since the major update an wpDiscuz 7.x there is an error within the method _getWPComments of the file /wp-content/plugins/wpdiscuz/class.WpdiscuzCore.php

In case of non paging comments the array $this->commentsArgs haven't an argument offset like in version 5.3.5.

This missing argument is relavant for the creation of the redis key within WordPress core method get_comments within WordPress core class class-wp-comment-query.php:

$_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) );
unset( $_args['fields'] );
$key = md5( serialize( $_args ) );
$last_changed = wp_cache_get_last_changed( 'comment' );
$cache_key = "get_comments:$key:$last_changed";
$cache_value = wp_cache_get( $cache_key, 'comment' );

See also:
https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-comment-query.php#L429

If your WordPress uses a redis plugin like Redis Object Cache and you will click on the "Load more comments" Button, the same initial comments will be loaded.

Many enterprise bussiness sites based on WordPress are using caching, so please fix this issues.

Best regards,
Ben

Topic Tags
2 Replies
Asti
Posts: 2144
 Asti
Support
(@asti)
Support member
Joined: 3 years ago

@benk,

We'll take this into consideration for future updates. 

Reply
bekind
Posts: 4
(@bekind)
New Member
Joined: 1 week ago

Hi @asti - I am having the exact same issue and we are too invested in wpdiscuz as well as redis so we cannot afford to remove either. My developers modified the file pointed by @benk to get "Load More" to work correctly. But that is obviously incorrect.

Can you please share when the solution to this issue is expeced? The way we use wpdisuz makes redis important as we get sudden traffic + comment spikes and redis cache helps us manage our infrastructure.

Regards

Reply
Share: