disqus-wordpress-plugin icon indicating copy to clipboard operation
disqus-wordpress-plugin copied to clipboard

"Deprecated: md5(): Passing null to parameter #1 ($string) of type string is deprecated" when $author is null

Open archon810 opened this issue 9 months ago • 4 comments

Describe the bug

There's apparently a comment with a null author, and it causes a deprecated warning in the plugin (PHP 8.1+).

To Reproduce

Steps to reproduce the behavior:
The comment ID in our case is: id:6635282509. https://apkmirror.disqus.com/admin/moderate/all/search/id:6635282509

Expected behavior

No notice.

Screenshots

Here's a screenshot from Sentry:

Image

Specifications:

  • Wordpress version: 6.7.2
  • Plugin version: 3.1.2
  • PHP: 8.1

archon810 avatar Mar 28 '25 01:03 archon810

Any updates please? It keeps pinging our Sentry. @chrisjtang

archon810 avatar Apr 28 '25 22:04 archon810

@archon810 Thanks for reporting. This should be fixed in the latest release of the plugin: https://github.com/disqus/disqus-wordpress-plugin/releases/tag/3.1.3

chrisjtang avatar Jun 30 '25 17:06 chrisjtang

@chrisjtang Please reopen, the bug is not fixed in 3.1.3.

ErrorException: Deprecated: md5(): Passing null to parameter #1 ($string) of type string is deprecated
#15 /wp-content/plugins/disqus-comment-system/rest-api/class-disqus-rest-api.php(789): Disqus_Rest_Api::comment_data_from_post
#14 /wp-content/plugins/disqus-comment-system/rest-api/class-disqus-rest-api.php(697): Disqus_Rest_Api::update_comment_from_post
#13 /wp-content/plugins/disqus-comment-system/rest-api/class-disqus-rest-api.php(661): Disqus_Rest_Api::create_or_update_comment_from_post
#12 /wp-content/plugins/disqus-comment-system/rest-api/class-disqus-rest-api.php(242): Disqus_Rest_Api::rest_sync_webhook
#11 /wordpress/wp-includes/rest-api/class-wp-rest-server.php(1292): WP_REST_Server::respond_to_request
#10 /wordpress/wp-includes/rest-api/class-wp-rest-server.php(1125): WP_REST_Server::dispatch
#9 /wordpress/wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server::serve_request
#8 /wordpress/wp-includes/rest-api.php(459): rest_api_loaded
#7 /wordpress/wp-includes/class-wp-hook.php(324): WP_Hook::apply_filters
#6 /wordpress/wp-includes/class-wp-hook.php(348): WP_Hook::do_action
#5 /wordpress/wp-includes/plugin.php(565): do_action_ref_array
#4 /wordpress/wp-includes/class-wp.php(418): WP::parse_request
#3 /wordpress/wp-includes/class-wp.php(818): WP::main
#2 /wordpress/wp-includes/functions.php(1342): wp
#1 /wordpress/wp-blog-header.php(16): require
#0 /index.php(23): null

With data: Image

archon810 avatar Jul 18 '25 21:07 archon810

@archon810 Hmm that is very strange. Based on the provided data and the author being null, it seems like the if ( $author ) check should prevent the thread of execution from entering that code block in the first place. Are you able to ascertain why the if block is being executed?

Off the top of my head, I'm thinking that we could add extra checks to prevent md5() from being called with null as the first parameter, but I would like to at least try to understand why it's being called in the first place if $author = null like it seems like it should be here https://github.com/disqus/disqus-wordpress-plugin/blob/master/disqus/rest-api/class-disqus-rest-api.php#L735

chrisjtang avatar Jul 21 '25 19:07 chrisjtang