Skip to content

Analytics leaderboard, there was an error getting your stats, PHP 8 types #33677

@alexx855

Description

@alexx855

Prerequisites

  • I have carried out troubleshooting steps and I believe I have found a bug.
  • I have searched for similar bugs in both open and closed issues and cannot find a duplicate.

Describe the bug

WP Admin > Analytics > Overview > Leaderboards section is not working with PHP 8

image

Expected behavior

It should display the leaderboard dashboard

Actual behavior

The endpoint /wp-json/wc-analytics/leaderboards returns 5xx err due to PHP 8 strict types conversion with the following message:

PHP Fatal error:  Uncaught Error: Object of class WP_Error could not be converted to string in /var/www/html/wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:176

Steps to reproduce

  1. Install WC 6.6.0/1 on a PHP 8 server
  2. Go to WP Admin > Analytics > Overview > Leaderboards section
  3. The request to the API fails and returns the following error if some taxonomy doesnt longer exist: this only happens with old/deleted taxonomies
{"code":"internal_server_error","message":"<p>There has been a critical error on this website.<\/p><p><a href=\"https:\/\/wordpress.org\/support\/article\/faq-troubleshooting\/\">Learn more about troubleshooting WordPress.<\/a><\/p>","data":{"status":500},"additional_errors":[]}

WordPress Environment

WordPress address (URL): http://localhost
Site address (URL): http://localhost
WC Version: 6.6.0
REST API Version: ✔ 6.6.0
WC Blocks Version: ✔ 7.6.0
Action Scheduler Version: ✔ 3.4.0
Log Directory Writable: ✔
WP Version: 6.0
WP Multisite: –
WP Memory Limit: 2 GB
WP Debug Mode: ✔
WP Cron: ✔
Language: en_US
External object cache: –

Server Environment

Server Info: nginx/1.21.0
PHP Version: 8.0.17
PHP Post Max Size: 100 MB
PHP Time Limit: 300
PHP Max Input Vars: 3000
cURL Version: 7.74.0
OpenSSL/1.1.1n

SUHOSIN Installed: –
MySQL Version: 10.7.3-MariaDB-1:10.7.3+maria~focal
Max Upload Size: 100 MB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔

Database

WC Database Version: 6.6.1
WC Database Prefix: wp_
Total Database Size: 1255.57MB
Database Data Size: 691.14MB
Database Index Size: 564.43MB
wp_woocommerce_sessions: Data: 2.52MB + Index: 0.05MB + Engine InnoDB
wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_order_itemmeta: Data: 0.05MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_actions: Data: 5.52MB + Index: 7.77MB + Engine InnoDB
wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_logs: Data: 5.52MB + Index: 4.03MB + Engine InnoDB
wp_affiliate_wp_affiliatemeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_affiliate_wp_affiliates: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_affiliate_wp_campaigns: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_affiliate_wp_coupons: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_affiliate_wp_creatives: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_affiliate_wp_customermeta: Data: 0.05MB + Index: 0.03MB + Engine InnoDB
wp_affiliate_wp_customers: Data: 0.06MB + Index: 0.03MB + Engine InnoDB
wp_affiliate_wp_direct_links: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_affiliate_wp_payouts: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_affiliate_wp_referralmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_affiliate_wp_referrals: Data: 0.20MB + Index: 0.02MB + Engine InnoDB
wp_affiliate_wp_rest_consumers: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_affiliate_wp_sales: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_affiliate_wp_visits: Data: 6.52MB + Index: 1.52MB + Engine InnoDB
wp_as3cf_items: Data: 7.52MB + Index: 1.88MB + Engine InnoDB
wp_automatewoo_abandoned_carts: Data: 1.52MB + Index: 0.08MB + Engine InnoDB
wp_automatewoo_customers: Data: 6.52MB + Index: 15.09MB + Engine InnoDB
wp_automatewoo_customer_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_automatewoo_events: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_automatewoo_guests: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_automatewoo_guest_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_automatewoo_logs: Data: 1.52MB + Index: 3.34MB + Engine InnoDB
wp_automatewoo_log_meta: Data: 4.52MB + Index: 6.03MB + Engine InnoDB
wp_automatewoo_queue: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_automatewoo_queue_meta: Data: 0.06MB + Index: 0.03MB + Engine InnoDB
wp_automatewoo_referrals: Data: 0.02MB + Index: 0.08MB + Engine InnoDB
wp_automatewoo_referral_advocate_keys: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_automatewoo_referral_invites: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
wp_failed_jobs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_followup_coupons: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_followup_coupon_logs: Data: 0.05MB + Index: 0.05MB + Engine InnoDB
wp_followup_customers: Data: 0.06MB + Index: 0.06MB + Engine InnoDB
wp_followup_customer_carts: Data: 1.52MB + Index: 0.09MB + Engine InnoDB
wp_followup_customer_notes: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_followup_customer_orders: Data: 0.05MB + Index: 0.02MB + Engine InnoDB
wp_followup_email_excludes: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_followup_email_logs: Data: 0.06MB + Index: 0.05MB + Engine InnoDB
wp_followup_email_orders: Data: 0.17MB + Index: 0.09MB + Engine InnoDB
wp_followup_email_tracking: Data: 0.02MB + Index: 0.08MB + Engine InnoDB
wp_followup_followup_history: Data: 0.20MB + Index: 0.05MB + Engine InnoDB
wp_followup_order_categories: Data: 0.05MB + Index: 0.03MB + Engine InnoDB
wp_followup_order_items: Data: 0.06MB + Index: 0.05MB + Engine InnoDB
wp_followup_subscribers: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_followup_subscribers_to_lists: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_followup_subscriber_lists: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_frm_fields: Data: 0.19MB + Index: 0.03MB + Engine InnoDB
wp_frm_forms: Data: 0.08MB + Index: 0.02MB + Engine InnoDB
wp_frm_items: Data: 2.52MB + Index: 1.03MB + Engine InnoDB
wp_frm_item_metas: Data: 4.52MB + Index: 1.92MB + Engine InnoDB
wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_mailchimp_carts: Data: 1.52MB + Index: 0.00MB + Engine InnoDB
wp_mailchimp_jobs: Data: 0.06MB + Index: 0.00MB + Engine InnoDB
wp_options: Data: 45.44MB + Index: 0.50MB + Engine InnoDB
wp_pmxe_exports: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_pmxe_google_cats: Data: 0.39MB + Index: 0.00MB + Engine InnoDB
wp_pmxe_posts: Data: 0.05MB + Index: 0.00MB + Engine InnoDB
wp_pmxe_templates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_postmeta: Data: 318.84MB + Index: 260.77MB + Engine InnoDB
wp_posts: Data: 151.66MB + Index: 97.33MB + Engine InnoDB
wp_queue: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_redirection_404: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_redirection_groups: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_redirection_items: Data: 0.02MB + Index: 0.08MB + Engine InnoDB
wp_redirection_logs: Data: 0.02MB + Index: 0.08MB + Engine InnoDB
wp_signups: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_usermeta: Data: 0.08MB + Index: 0.03MB + Engine InnoDB
wp_users: Data: 12.52MB + Index: 13.55MB + Engine InnoDB
wp_wcct_evergreen: Data: 0.02MB + Index: 0.08MB + Engine InnoDB
wp_wcct_evergreenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wcs_payment_retries: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_admin_notes: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_order_bundle_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_bundled_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_bundled_items: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_exported_csv_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wpfm_backup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wpmailsmtp_debug_events: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wpmailsmtp_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wrd_discounts: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wrd_sent_coupons: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_yoast_indexable: Data: 89.64MB + Index: 124.52MB + Engine InnoDB
wp_yoast_indexable_hierarchy: Data: 17.55MB + Index: 21.55MB + Engine InnoDB
wp_yoast_migrations: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_yoast_primary_term: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_yoast_prominent_words: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_yoast_seo_links: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_yoast_seo_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB

Post Type Counts

acf-field: 149
acf-field-group: 6
amp_validated_url: 4
ampforwp_story: 1
amppb_layout: 2
attachment: 3532
aw_workflow: 27
course: 1
custom_css: 1
customize_changeset: 5
docs: 46
equipment: 9
follow_up_email: 1
frm_form_actions: 32
frm_styles: 1
jetpack_migration: 2
lesson: 7
movements: 749
movies: 21
nav_menu_item: 97
oembed_cache: 205
page: 100
post: 177
product: 82
product_variation: 15
program: 16
quiz: 7
revision: 3285
shop_coupon: 1497
shop_order: 2
shop_order_refund: 166
shop_subscription: 2
smart_offers: 14
sponsors: 7
testimonials: 29
twcbp_block: 89
wc_membership_plan: 17
wc_user_membership: 13
wcct_countdown: 10
workout_session: 415194
workouts: 988
wp_block: 10
wpmm_theme: 3
ywrfd-discount: 1

Security

Secure connection (HTTPS): ❌
Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates.
Hide errors from visitors: ❌Error messages should not be shown to visitors.

Active Plugins (1)

WooCommerce: by Automattic – 6.6.0 (update to version 6.6.1 is available)

Inactive Plugins (52)

Advanced Custom Fields PRO: by Delicious Brains – 5.12.2
AffiliateWP: by AffiliateWP – 2.9.3
Akismet Anti-Spam: by Automattic – 4.2.4
Async JavaScript: by Frank Goossens (futtta) – 2.21.08.31
AutomateWoo: by WooCommerce – 5.5.15
AutomateWoo - Refer A Friend Add-on: by WooCommerce – 2.6.7
Autoptimize: by Frank Goossens (futtta) – 3.0.4
Coinbase Commerce: by Coinbase Commerce – 1.1.4
Custom Post Type UI: by WebDevStudios – 1.12.1
DeBounce.io Email Validator: by DeBounce.io – 3.3.0
Disable Gutenberg: by Jeff Starr – 2.7
Finale - WooCommerce Sales Countdown Timer & Discount Plugin: by XLPlugins – 2.18.0
Finale Evergreen Campaigns: by XLPlugins – 1.3.0
Formidable Forms: by Strategy11 – 5.3.2
Formidable Forms Pro: by Strategy11 – 5.3.2
Formidable Registration: by Strategy11 – 2.07
Gastro Core: by Twisttheme – 1.1.5
GTM4WP: by Thomas Geiger – 1.15.2
Intercom: by Intercom – 2.6.5
JWT Auth: by Useful Team – 2.1.0
No CAPTCHA reCAPTCHA for WooCommerce: by MailOptin Team – 1.2.6
Post Duplicator: by Metaphor Creations – 2.28
Printful Integration for WooCommerce: by Printful – 2.1.33
Smart Offers: by StoreApps – 4.2.1
Surfsc App API: by wattagency – 6.3.1
User Switching: by John Blackbourn & contributors – 1.5.8
Variation Swatches for WooCommerce: by Emran Ahmed – 2.0.1
Variation Switcher in Cart for WooCommerce: by FantasticPlugins – 1.5
Widget CSS Classes: by Jory Hogeveen – 1.5.4.1
WooCommerce Admin: by WooCommerce – 3.3.2
WooCommerce Blocks: by Automattic – 7.8.0
WooCommerce Customer/Order/Coupon Export: by SkyVerge – 5.3.3
WooCommerce Intercom Integration: by ektagon – 1.13.2
WooCommerce Memberships: by SkyVerge – 1.23.0
WooCommerce Order Status Control: by SkyVerge – 1.14.0
WooCommerce PayPal Payments: by WooCommerce – 1.8.1
WooCommerce Product Bundles: by WooCommerce – 6.15.5
WooCommerce Product Reviews Pro: by SkyVerge – 1.17.4
WooCommerce Smart Coupons: by StoreApps – 5.5.0 (update to version 5.6.0 is available)
WooCommerce Social Login: by SkyVerge – 2.11.1
WooCommerce Stripe Gateway: by WooCommerce – 6.4.1
WooCommerce Subscriptions: by WooCommerce – 4.4.0
Woo Partial.ly: by Partially Inc – 2.1.15
WP Crontrol: by John Blackbourn & crontributors – 1.12.1
WP Mail SMTP Pro: by WPForms – 3.4.0
WP Migrate: by Delicious Brains – 2.3.3
WP Offload Media: by Delicious Brains – 2.6.2
WP Super Cache: by Automattic – 1.7.9
WP User Avatars: by Triple J Software
Inc. – 1.4.1

Yoast SEO: by Team Yoast – 19.0
Yoast SEO: WooCommerce: by Team Yoast – 14.8
Yoast SEO Premium: by Team Yoast – 18.6

Must Use Plugins (2)

WP Migrate DB Pro Compatibility: by Delicious Brains – 1.2
WP Synchro MU plugin: by WP Synchro – 1.0.3

Settings

API Enabled: ✔
Force SSL: –
Currency: USD ($)
Currency Position: left
Thousand Separator: ,
Decimal Separator: .
Number of Decimals: 2
Taxonomies: Product Types: bundle (bundle)
external (external)
grouped (grouped)
simple (simple)
subscription (subscription)
variable (variable)
variable subscription (variable-subscription)

Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
exclude-from-search (exclude-from-search)
featured (featured)
outofstock (outofstock)
rated-1 (rated-1)
rated-2 (rated-2)
rated-3 (rated-3)
rated-4 (rated-4)
rated-5 (rated-5)

Connected to WooCommerce.com: ✔
Enforce Approved Product Download Directories: –

WC Pages

Shop base: #27807 - /surf-training-programs/
Cart: ❌ Page does not contain the [woocommerce_cart] shortcode or the woocommerce/cart block.
Checkout: ❌ Page does not contain the [woocommerce_checkout] shortcode or the woocommerce/checkout block.
My account: ❌ Page does not contain the [woocommerce_my_account] shortcode.
Terms and conditions: #3907 - /terms-and-conditions/

Theme

Name: Twenty Twenty-Two
Version: 1.2
Author URL: https://wordpress.org/
Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme
WooCommerce Support: ✔

Templates

Overrides: –

Admin

Enabled Features: activity-panels
analytics
coupons
customer-effort-score-tracks
experimental-products-task
experimental-import-products-task
experimental-fashion-sample-products
homescreen
marketing
mobile-app-banner
navigation
onboarding
onboarding-tasks
remote-inbox-notifications
remote-free-extensions
payment-gateway-suggestions
shipping-label-banner
subscriptions
store-alerts
transient-notices
wc-pay-promotion
wc-pay-welcome-page
wc-pay-subscriptions-page

Disabled Features: minified-js
settings

Daily Cron: ✔ Next scheduled: 2022-06-10 14:02:06 -08:00
Options: ✔
Notes: 28
Onboarding: completed

Action Scheduler

Complete: 14,749
Oldest: 2022-05-10 00:14:04 +0000
Newest: 2022-06-09 14:34:44 +0000

Pending: 607
Oldest: -0001-11-30 00:00:00 +0000
Newest: 2023-06-16 14:13:36 +0000

Failed: 365
Oldest: 2019-12-03 11:04:15 +0000
Newest: 2022-05-11 21:55:04 +0000

Canceled: 21
Oldest: 2022-05-16 18:50:48 +0000
Newest: -0001-11-30 00:00:00 +0000

Status report information

Generated at: 2022-06-30 04:16:20 -08:00

Isolating the problem

  • I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
  • This bug happens with a default WordPress theme active, or Storefront.
  • I can reproduce this bug consistently using the steps above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugThe issue is a confirmed bug.Reports/AnalyticsIssues related to analytics section.plugin: woocommerceIssues related to the WooCommerce Core plugin.status: developer reproductionBug reports that need to be reproduced and confirmed by a developer.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions