Uncaught TypeError: Unsupported operand types: string – int
-
Hi!
We recently got our servers updated from PHP 7.4 to PHP 8.2. We then noticed that we got a fatal error:
PHP Fatal error: Uncaught TypeError: Unsupported operand types: string – int in wp-content/plugins/woocommerce/src/Internal/Admin/WCPayPromotion/Init.php:89
It seems to happen only if we haven’t manually rearranged the order of gateways. To temporarily fix, we’ve commented out the logic in question.
-
Hello Ann Lickander,
Thank you for contacting WooCommerce support.
I understand you are facing a fatal error after upgrading to PHP 8.2.
To troubleshoot this, I would like to reproduce this error on my test site.
To help me with that please share your site’s System Status Report.
You can paste it into https://pastebin.com and share the link here.Looking forward to your response. ??
Hi!
Sorry for the late reply.
Here is the report: https://pastebin.com/8vi6RmTm
I did remove all the database tables. We have over 200 sites in the installation, so it was a looooong list of tables…Hi there!
Thank you for sharing the SSR. I have checked the report and I can see you are using an outdated WooCommerce database version (9.5.2). Additionally, your WooCommerce and WordPress installations are not up to date.
Could you please first update your WordPress and WooCommerce to the latest versions and then try updating the WooCommerce database? You can update the WooCommerce database by going to WooCommerce → Status → Tools, then look for the “Update Database” button and click it to update.
Alternatively, you can try accessing your database directly to check for any pending notifications. Here’s how:
- Go to your WP database and locate the
wp_wc_admin_notes
?table. - Look for any entries related to the database update and check if the status is set to?Pending.
- If so, you can manually change the status to?Actioned?to see if this resolves the issue.
The table structure should look something like this:
Please give this a try, and let me know if it makes a difference. (please make sure to take the site backup before update).
Hi!
We made an update now, and. It seems like we don’t get the problem with the editor anymore. BUT, we still get the error. This time when trying to access WooCommerce->Settings->Payments. When trying to access that page we get a Fatal Error message. And when checking the debug log, it’s the same problem as before:[03-Mar-2025 13:54:56 UTC] PHP Fatal error: Uncaught TypeError: Unsupported operand types: string - int in wp-content/plugins/woocommerce/src/Internal/Admin/WCPayPromotion/Init.php:96
Stack trace:
#0 wp-includes/class-wp-hook.php(326): Automattic\WooCommerce\Internal\Admin\WCPayPromotion\Init::set_gateway_top_of_list()
#1 wp-includes/plugin.php(205): WP_Hook->apply_filters()
#2 wp-includes/option.php(247): apply_filters()
#3 wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php(94): get_option()
#4 wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php(73): WC_Payment_Gateways->init()
#5 wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php(46): WC_Payment_Gateways->__construct()
#6 wp-content/plugins/woocommerce/includes/class-woocommerce.php(1159): WC_Payment_Gateways::instance()
#7 wp-content/plugins/woocommerce/includes/class-woocommerce.php(200): WooCommerce->payment_gateways()
#8 wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/AdditionalPayments.php(185): WooCommerce->__get()
#9 wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/AdditionalPayments.php(154): Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks\AdditionalPayments::has_enabled_gateways()
#10 wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/AdditionalPayments.php(115): Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks\AdditionalPayments::has_enabled_other_category_gateways()
#11 wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/TaskList.php(305): Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks\AdditionalPayments->can_view()
#12 [internal function]: Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskList->Automattic\WooCommerce\Admin\Features\OnboardingTasks\{closure}()
#13 wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/TaskList.php(302): array_filter()
#14 wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/TaskList.php(171): Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskList->get_viewable_tasks()
#15 wp-content/plugins/woocommerce/src/Internal/Admin/WcPayWelcomePage.php(378): Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskList->is_visible()
#16 wp-content/plugins/woocommerce/src/Internal/Admin/WcPayWelcomePage.php(151): Automattic\WooCommerce\Internal\Admin\WcPayWelcomePage->get_active_payments_task_slug()
#17 wp-includes/class-wp-hook.php(324): Automattic\WooCommerce\Internal\Admin\WcPayWelcomePage->register_menu_and_page()
#18 wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#19 wp-includes/plugin.php(517): WP_Hook->do_action()
#20 wp-admin/includes/menu.php(161): do_action()
#21 wp-admin/menu.php(412): require_once('/...')
#22 wp-admin/admin.php(158): require('/...')
#23 {main}
thrown in wp-content/plugins/woocommerce/src/Internal/Admin/WCPayPromotion/Init.php on line 96New status report:
### WordPress Environment ###
WC Version: 9.7.0
Legacy REST API Package Version: Till?gget Legacy REST API ?r inte installerat p? denna webbplats.
Action Scheduler Version: ? 3.9.0
Log Directory Writable: ?
WP Version: 6.7.2
WP Multisite: ?
WP Memory Limit: 512 MB
WP Debug Mode: ?
WP Cron: –
Language: sv_SE
External object cache: ?
### Server Environment ###
Server Info: LiteSpeed
PHP Version: 8.2.27
PHP Post Max Size: 512 MB
PHP Time Limit: 90
PHP Max Input Vars: 3000
cURL Version: 8.11.0
OpenSSL/1.1.1w
SUHOSIN Installed: –
MySQL Version: 10.6.21-MariaDB-cll-lve
Max Upload Size: 512 MB
Default Timezone is UTC: ?
fsockopen/cURL: ?
SoapClient: ?
DOMDocument: ?
GZip: ?
Multibyte String: ?
Remote Post: ?
Remote Get: ?
### Database ###
WC Database Version: 9.7.0
WC Database Prefix: wp_294_
Total databasstorlek: 48.95MB
Datastorlek f?r databas: 33.04MB
Indexstorlek f?r databas: 15.91MB
### Post Type Counts ###
attachment: 270
foyer_display: 1
nav_menu_item: 38
page: 56
person: 2
post: 44
revision: 662
tribe_event_series: 2
tribe_events: 128
wp_font_face: 36
wp_font_family: 12
wp_navigation: 1
### Security ###
Secure connection (HTTPS): ?
Hide errors from visitors: ?
### Active Plugins (35) ###
ACF to REST API: av Aires Gon?alves – 3.3.4
Admin Columns Pro: av AdminColumns.com – 6.4.15
Advanced Custom Fields PRO: av WP Engine – 6.3.12
Block Visibility: av Nick Diego – 3.7.1
Yoast Duplicate Post: av Enrico Battocchi & Team Yoast – 4.5
Firelight Lightbox: av FirelightWP – 2.3.11
Enable Media Replace: av ShortPixel – 4.1.5
Events Calendar PRO: av Evenemangskalender – 7.4.1
FacetWP: av FacetWP
LLC – 4.3.6
Gravity Forms Event Tracking: av Ronald Huereca – 2.5.0
Gravity Forms: av Gravity Forms – 2.9.4
Gravity Forms ut?kning f?r enk?ter: av Gravity Forms – 4.1.0
Instagram Feed Pro Developer: av Smash Balloon – 6.6.1
LiteSpeed Cache: av LiteSpeed Technologies – 6.5.4
oEmbed Plus: av Ayesh Karunaratne – 1.6
Safe SVG: av 10up – 2.3.1
Simple History: av P?r Thernstr?m – 5.7.0
The Events Calendar: Filter Bar: av The Events Calendar – 5.5.8
The Events Calendar: av The Events Calendar – 6.10.1.1
Obekr?ftade: av Boone B Gorges – 1.3.7
User Switching: av John Blackbourn – 1.9.1
PDF Invoices & Packing Slips for WooCommerce: av WP Overnight – 4.1.1
Sequential Order Numbers for WooCommerce: av SkyVerge – 1.11.0
WooCommerce: av Automattic – 9.7.0
Yoast SEO: av Team Yoast – 24.5
WordPress Sentry: av Alex Bouma – 8.3.1
### Settings ###
Legacy API Enabled: –
Force SSL: –
Currency: SEK (kr)
Currency Position: right
Thousand Separator:
Decimal Separator: ,
Number of Decimals: 2
Taxonomies: Product Types: external (external)
grouped (grouped)
simple (simple)
variable (variable)
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: ?
HPOS feature enabled: ?
Order datastore: Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore
HPOS data sync enabled: –
### Logging ###
Enabled: ?
Handler: Automattic\WooCommerce\Internal\Admin\Logging\LogHandlerFileV2
Retention period: 30 dagar
Level threshold: –
Log directory size: 1 MB
### WC Pages ###
Butikbas: #909 - /butik/
Varukorg: #910 - /varukorg/ - Inneh?ller blocket woocommerce/cart
Kassan: #911 - /kassan/ - Inneh?ller blocket woocommerce/checkout
Mitt konto: #912 - /mitt-konto/ - Inneh?ller kortkoden [woocommerce_my_account]
Villkor: ? Sida har inte valts
### Theme ###
Name: Custom
### Templates ###
Overrides: –
### Admin ###
Enabled Features: activity-panels
analytics
product-block-editor
coupons
core-profiler
customize-store
customer-effort-score-tracks
import-products-task
experimental-fashion-sample-products
shipping-smart-defaults
shipping-setting-tour
homescreen
marketing
mobile-app-banner
onboarding
onboarding-tasks
pattern-toolkit-full-composability
product-custom-fields
remote-inbox-notifications
remote-free-extensions
payment-gateway-suggestions
printful
shipping-label-banner
subscriptions
store-alerts
transient-notices
woo-mobile-welcome
wc-pay-promotion
wc-pay-welcome-page
launch-your-store
add-to-cart-with-options-stepper-layout
Disabled Features: product-data-views
experimental-blocks
coming-soon-newsletter-template
minified-js
product-pre-publish-modal
settings
async-product-editor-category-field
product-editor-template-system
blueprint
reactify-classic-payments-settings
use-wp-horizon
blockified-add-to-cart
Daily Cron: ? Next scheduled: 2025-03-03 16:39:18 +01:00
Options: ? Inte alla f?rv?ntade
Notes: 9
Onboarding: -
### Action Scheduler ###
F?rdigbehandlad: 98
Oldest: 2025-01-31 23:23:51 +0100
Newest: 2025-03-03 14:53:01 +0100
Misslyckades: 1
Oldest: 2023-11-01 20:11:40 +0100
Newest: 2023-11-01 20:11:40 +0100
V?ntar: 2
Oldest: 2025-03-04 09:23:30 +0100
Newest: 2025-03-09 10:57:13 +0100
### Status report information ###
Generated at: 2025-03-03 14:56:41 +01:00 - Go to your WP database and locate the
- You must be logged in to reply to this topic.