rankmath / seo-by-rank-math

Rank Math is a revolutionary WordPress SEO Plugin that combines the features of many SEO tools and lets you multiply your traffic in the easiest way possible :bulb: :chart_with_upwards_trend: →
https://rankmath.com
107 stars 52 forks source link

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

Open stafflink-web-services opened 12 months ago

stafflink-web-services commented 12 months ago

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