sophi-for-wordpress icon indicating copy to clipboard operation
sophi-for-wordpress copied to clipboard

Plugin warnings on PHP8

Open dnass opened this issue 2 years ago • 5 comments

Describe the bug

Hello,

After updating Global News' production server to PHP8 yesterday, we began seeing warnings from Sophi plugin code in our logs. The warnings are: Undefined property: WP_Post_Type::$post_type in /var/www/wp-content/plugins/sophi/includes/functions/utils.php on line 133 and Undefined array key 0 in /var/www/wp-content/plugins/sophi/includes/functions/utils.php on line 84

Both of these appear to be related to the get_post_breadcrumb function.

We're only seeing these appear on routes for two post types: events and contests, which are both outside the scope of our Sophi curation and not included in our supported_post_types array.

Let me know if you need any more information in order to address this issue.

Thanks, Daniel

Steps to Reproduce

  • Install sophi for wordpress plugin
  • Upgrade server to PHP8
  • View application logs in VIP dashboard

Screenshots, screen recording, code snippet

gn-logs.csv

Environment information

PHP 8.0 WordPress 6.0.3 sophi-for-wordpress 1.2.1 Site is hosted on WordPress VIP

WordPress information

No response

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

dnass avatar Nov 10 '22 17:11 dnass

Will want to see if this still occurs in 1.3.0 (or 1.3.1 which lands soon) and if so then work on handling for the warnings. Also I don't expect that this would have been something that our tests in PHP Compatibility or PHP Compatibility-dev for 8.0 would have caught since this is coming in via CPTs outside the scope of our automated testing currently. I'm milestoning for 1.4.0 as our next planned release where we can look to research/resolve this issue.

jeffpaul avatar Nov 10 '22 18:11 jeffpaul

Also... @dnass welcome to the Sophi plugin and thanks for the testing and feedback, much appreciated as it helps us iterate and improve the plugin!

jeffpaul avatar Nov 10 '22 18:11 jeffpaul

Thanks @jeffpaul — we should be updating to 1.3.0/1.3.1 on prod by early next week, so I'll be able to let you know then.

dnass avatar Nov 10 '22 18:11 dnass

@dnass awesome, many thanks!

jeffpaul avatar Nov 10 '22 19:11 jeffpaul

Hi @jeffpaul — I just rolled out 1.3.1 on our staging server, which is the same environment setup as prod. Still seeing these two errors appearing on event and contest pages, so I don't think they've been resolved by the update.

dnass avatar Nov 14 '22 16:11 dnass