-
Notifications
You must be signed in to change notification settings - Fork 210
Check that author variable is of the expected type #7838
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
base: trunk
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a warning that occurs when attempting to access the display_name property on a boolean value instead of a WP_User object. The issue was reported when using the Sensei plugin with Safety Net.
Key changes:
- Updated
get_term_author()documentation to accurately reflect that it can returnWP_User|false - Added type check to ensure
$authoris aWP_Userinstance before accessing its properties
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| includes/class-sensei-modules.php | Updated function documentation and added type safety check before accessing $author->display_name property |
| changelog/fix-variable-type-mismatch | Added changelog entry documenting the fix |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Fixes an issue reported by Team51:
Proposed Changes
Check that
$authoris aWP_Userobject before trying to access thedisplay_nameproperty.Though I wasn't able to reproduce the reported issue, this seems like a safe change.
Pre-Merge Checklist