Please submit a private ticket if you need to share sensitive information, such as license details and admin credentials.

Okay
  Public Ticket #4572845
Bug Report - PHP TypeError in wpc-variations-radio-buttons Plugin
Open

Comments

  • Kristýna Kadlecová started the conversation

    Dear WPC Variations Radio Buttons Support,

    We have encountered a critical bug in your plugin that prevents saving product variations in WooCommerce.

    Issue: When saving product variations, we receive a Fatal PHP error:

    ###b class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_10ocf_9 _ghost_10ocf_96" type="button" aria-label="Copy to clipboard" data-state="closed"###

    PHP Fatal error: Uncaught TypeError: ltrim(): Argument #1 ($string) must be of type string, array given in /wp-includes/formatting.php:4487

    Error Location: File: /wp-content/plugins/wpc-variations-radio-buttons/includes/class-backend.php Line: 554 (and also lines 548, 560)

    Root Cause: The issue is in the null coalescing operator syntax:

    ###b class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_10ocf_9 _ghost_10ocf_96" type="button" aria-label="Copy to clipboard" data-state="closed"###

    php

    // Current (WRONG):
    sanitize_url( wp_unslash( $_POST['woovr_image'] ?? ''[ $post_id ] ) )
    // Possible solution:
    sanitize_url( wp_unslash( $_POST['woovr_image'][ $post_id ] ?? '' ) )

    The array index [ $post_id ] needs to come BEFORE the null coalescing operator ??, not after.

    Environment:

    • WordPress: [7.0]
    • WooCommerce: [10.9.1]
    • Plugin Version: 3.8.2]

    To Reproduce:

    1. Go to WooCommerce → Products
    2. Edit any product with variations
    3. Try to save variation settings
    4. Check debug.log for the error

    Could you please fix this issue? This is preventing us from managing our product variations.

    Thank you,Kris

  •  1,705
    Dustin replied

    Hi Kristýna,

    Thank you for reporting this issue to us.

    Please update the plugin to the latest version 3.8.3 and try again. I have just fixed it.

    Best regards,
    Dustin