seo-by-rank-math icon indicating copy to clipboard operation
seo-by-rank-math copied to clipboard

Fatal Error in class-user.php:46 : There are no checks in place for the Object Type.

Open stafflink-web-services opened this issue 1 year ago • 0 comments

Describe the bug In some instances, Rank Math is trying to get user meta data on an object that is not a user. Some plugins (like easy property listings) will allow filtering of a post type (property for example) via query strings. If this is used on the property post type archive, Rank Math attempts to get the user meta on this archive.

To Reproduce Steps to reproduce the behavior:

  1. Install Easy Property Listings
  2. add this search param: to your property archive: ?action=epl_search&post_type=property&property_status=current&author_name={user-nicename}
  3. See error

Expected behavior This function should only run on users(?). Sorry, I'm not 100% sure when it should run, but given the class naming, it should only operate on user meta, or the WP_User object.

Desktop (please complete the following information): Not applicable.

Smartphone (please complete the following information): Not applicable

Additional context Warning on PHP 7.4, and Fatal error on PHP 8 +

I created a pull request: https://github.com/rankmath/seo-by-rank-math/pull/255/commits/65a7ca0ad006322c9fd852c90fadf095bf413c06

stafflink-web-services avatar Oct 25 '23 00:10 stafflink-web-services