• pollution

    (@pollution)


    Saving variations on a variable product throws a fatal error:

    PHP Fatal error: Uncaught TypeError: ltrim(): Argument #1 ($string) must be of type string, array given in wp-includes/formatting.php:4487 1 wp-includes/formatting.php(4619): esc_url(Array, NULL, ‘db’) 2 wp-content/plugins/wpc-variations-radio-buttons/includes/class-backend.php(554): sanitize_url(Array) 3 WPClever_Woovr_Backend->save_variation_settings(…)

    Cause: in includes/class-backend.php (save_variation_settings), lines 547, 554, 561:

    sanitize_url( wp_unslash( $_POST[‘woovr_image’] ?? ”[ $post_id ] ) )

    [] binds tighter than ??, so PHP evaluates this as:

    $_POST[‘woovr_image’] ?? ( ”[ $post_id ] )

    Since $_POST[‘woovr_image’] is set (it’s the array keyed by variation id), the whole array is returned and passed to sanitize_url() → fatal on PHP 8.

    Fix: move the subscript inside the coalesce:

    sanitize_url( wp_unslash( $_POST[‘woovr_image’][ $post_id ] ?? ” ) )

    Same fix needed on all three lines (woovr_name, woovr_image, woovr_image_id).

Viewing 1 replies (of 1 total)
  • webdesign2030

    (@webdesign2030)

    Plugin now working properly. Version 3.8.3 has been released which corrects the bugs.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.