Skip to content

Conversation

@dd32
Copy link
Contributor

@dd32 dd32 commented Feb 13, 2025

A PHP Warning is triggered on sites that require comment registrations, during pingback creations.

Eg.

E_WARNING: Attempt to read property "display_name" on bool in /wp-content/plugins/stream/connectors/class-connector-comments.php:200
Source: POST https://example.org/xmlrpc.php
UA: The Incutio XML-RPC PHP Library -- WordPress/6.7.2
Filter stack: wp_insert_comment

This is because WP_Comment->user_id will always exist, although it may be empty.

This PR does two things:

  • Check that the user_id is empty (ie. not 0)
  • Copies over the existing logic for when a user can't be found via email, in the event the user object can't be found.

Checklist

  • Project documentation has been updated to reflect the changes in this pull request, if applicable.
  • I have tested the changes in the local development environment (see contributing.md).
  • I have added phpunit tests.

Release Changelog

  • Fix: Avoid triggering PHP Warnings under PHP 8.x

Release Checklist

  • This pull request is to the master branch.
  • Release version follows semantic versioning. Does it include breaking changes?
  • Update changelog in readme.txt.
  • Bump version in stream.php.
  • Bump Stable tag in readme.txt.
  • Bump version in classes/class-plugin.php.
  • Draft a release on GitHub.

Change [ ] to [x] to mark the items as done.

dd32 added 2 commits February 13, 2025 13:10
In some cases `require_name_email` and `comment_registration` will both be enabled, the details from the email lookup should be respected before falling back to the comment author name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant