You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 18, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 18, 2026. It is now read-only.
While using the Newspack plugin for user subscriptions, we encountered a PHP Recoverable Error in WooCommerce Subscriptions (v7.2.1). The error message is:
Mar 15/2025 17:37:31 > 2025-03-15T23:37:31.110382193Z stderr F [15-Mar-2025 23:37:31 UTC] PHP Recoverable Error: Uncaught exception 'TypeError' with message 'Illegal offset type' in /app/web/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/wcs-functions.php on line 545, request: POST /?wc-ajax=checkout, request_id: e967e093b4f5349ea14b983f851acb73
This is the line
$subscriptions[ $subscription_id ] = wcs_get_subscription( $subscription_id );
All the plugins and wordpress are el the latest version.
It looks like the error is happening because the $subscription_id is not the right type (it should be a string or an integer). To fix this, you can check if it's the correct type before using it like this:
if (is_string($subscription_id) || is_int($subscription_id)) {
$subscriptions[ $subscription_id ] = wcs_get_subscription( $subscription_id );
} else {
// Log the error or show a messageerror_log('Invalid subscription ID type: ' . var_export($subscription_id, true));
}
This will prevent the "Illegal offset type" error.
Activity
yashhhYB commentedon Apr 12, 2025
It looks like the error is happening because the
$subscription_idis not the right type (it should be a string or an integer). To fix this, you can check if it's the correct type before using it like this:This will prevent the "Illegal offset type" error.