• Any ideas how to fix fatal error in WooCommerce with PHP8? On PHP 7.4 all works fine.

    Here is the error message:

    Fatal error: Uncaught TypeError: Unsupported operand types: int / string in /var/www/vhosts/tomtalk.co/ca7.pl/wp-content/plugins/woocommerce/includes/wc-core-functions.php:987 Stack trace: #0 /var/www/vhosts/tomtalk.co/ca7.pl/wp-content/plugins/woocommerce/includes/class-woocommerce.php(658): wc_get_image_size() #1 /var/www/vhosts/tomtalk.co/ca7.pl/wp-includes/class-wp-hook.php(292): WooCommerce->add_image_sizes() #2 /var/www/vhosts/tomtalk.co/ca7.pl/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters() #3 /var/www/vhosts/tomtalk.co/ca7.pl/wp-includes/plugin.php(484): WP_Hook->do_action() #4 /var/www/vhosts/tomtalk.co/ca7.pl/wp-settings.php(560): do_action() #5 /var/www/vhosts/tomtalk.co/ca7.pl/wp-config.php(86): require_once('/var/www/vhosts...') #6 /var/www/vhosts/tomtalk.co/ca7.pl/wp-load.php(37): require_once('/var/www/vhosts...') #7 /var/www/vhosts/tomtalk.co/ca7.pl/wp-admin/admin.php(34): require_once('/var/www/vhosts...') #8 {main} thrown in /var/www/vhosts/tomtalk.co/ca7.pl/wp-content/plugins/woocommerce/includes/wc-core-functions.php on line 987

    This is a fresh installation for test purposes.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Aashik P – a11n

    (@aashik)

    Hi there!

    Could you please share a copy of your site’s System Status? You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”.? Once you’ve done that, paste it here in your response.

    I’m asking because with the latest version of WooCommerce and WordPress installed on a local machine, I’m not seeing the error you’re reporting:

    php8
    Link to image: https://d.pr/i/HeY0Lj

    Received help via Slack already and all works:

    1. change wc-core-functions.php:985 to

    $width = max( 1, intval( current( $cropping_split ) ) );

    2. change wc-core-functions.php:987 to

    $size['height'] = absint( NumberUtil::round( ( $size['width'] / $width ) * $height ) );

    Credits goes to BrianHenry

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP8 Fatal Error in WooCommerce 5.1’ is closed to new replies.