Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter chatseb

    (@chatseb)

    Update I used this snippet, which resolved the issue on my site, may be helpful for anyone who faces the same issue.

    /**

    • Description: Patches three bugs in class-wcfm-stripe-connect-client.php.
    • Bug 1 & 2: On PHP 8, get_user_meta() returns an empty string when
    • the wcfmmp_profile_settings meta key does not yet exist for a vendor.
    • WCFM then attempts array offset access on that string which is a fatal
    • TypeError in PHP 8. This fix ensures the meta is always initialised as
    • an array before WCFM processes any Stripe connect or disconnect action.
    • Bug 3: If create_account() fails and returns null during a connect type
    • switch, WCFM immediately accesses ->id on the null return value causing
    • a fatal error on any PHP version. This fix guards against a null account
    • being passed into the account links args.
      */

    // Fix 1 & 2: Ensure wcfmmp_profile_settings is always an array before Stripe connect/disconnect
    add_action( ‘template_redirect’, function() {
    if ( isset( $_GET[‘stripe_action’] ) ) {
    $user_id = get_current_user_id();
    if ( $user_id ) {
    $vendor_data = get_user_meta( $user_id, ‘wcfmmp_profile_settings’, true );
    if ( ! is_array( $vendor_data ) ) {
    update_user_meta( $user_id, ‘wcfmmp_profile_settings’, array() );
    }
    }
    }
    });

    // Fix 3: Guard against null account in create_account_link
    add_filter( ‘wcfm_stripe_account_links_args’, function( $params ) {
    if ( isset( $params[‘account’] ) && is_null( $params[‘account’] ) ) {
    $params[‘account’] = ”;
    }
    return $params;
    });

Viewing 1 replies (of 1 total)