Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments Connector: Avoid a PHP Warning on pingbacks. #1697

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

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.

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