Mather-Sophi / sophi-for-wordpress

WordPress VIP-compatible plugin for the Sophi.io Site Automation service.
https://sophi.io
GNU General Public License v2.0
21 stars 7 forks source link

Plugin warnings on PHP8 #364

Open dnass opened 1 year ago

dnass commented 1 year ago

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

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

jeffpaul commented 1 year ago

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 commented 1 year ago

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!

dnass commented 1 year ago

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.

jeffpaul commented 1 year ago

@dnass awesome, many thanks!

dnass commented 1 year ago

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.