• Resolved wpreceiver

    (@wpreceiver)


    I am getting this error on error_log file.

    [02-Mar-2023 07:32:48 UTC] PHP Warning: Undefined array key "width" in /home/website/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images.php on line 276
    [02-Mar-2023 07:32:48 UTC] PHP Warning: Undefined array key "height" in /home/
    home/website/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images.php on line 277
    [02-Mar-2023 07:32:48 UTC] PHP Warning: Undefined array key "width" in /home/home/website/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images.php on line 276
    [02-Mar-2023 07:32:48 UTC] PHP Warning: Undefined array key "height" in /home/home/website/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images.php on line 277
    [02-Mar-2023 07:32:48 UTC] PHP Warning: Undefined array key "width" in /home/website/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images.php on line 276
    [02-Mar-2023 07:32:48 UTC] PHP Warning: Undefined array key "height" in /home/website/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images.php on line 277
    [02-Mar-2023 07:32:48 UTC] PHP Warning: Undefined array key "width" in /home/website/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images.php on line 276
    [02-Mar-2023 07:32:48 UTC] PHP Warning: Undefined array key "height" in /home/website/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images.php on line 277
    [02-Mar-2023 07:32:48 UTC] PHP Warning: Undefined array key "width" in /home/website/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images.php on line 276
    [02-Mar-2023 07:32:48 UTC] PHP Warning: Undefined array key "height" in /home/website/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images.php on line 277
    [02-Mar-2023 07:32:48 UTC] PHP Warning: Undefined array key "width" in /home/website/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images.php on line 276
    [02-Mar-2023 07:32:48 UTC] PHP Warning: Undefined array key "height" in /home/website/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images.php on line 277

    What should be the solution for this?

    • This topic was modified 1 year, 9 months ago by wpreceiver.
    • This topic was modified 1 year, 9 months ago by wpreceiver.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Roxy

    (@roxannestoltz)

    Hi @wpreceiver ,

    Thanks for reaching out!

    In past cases where we have seen the error message you are seeing, it was a result of a conflict between WooCommerce, another plugin on the site, and the site’s PHP version.

    This being said, I’d suggest performing a full conflict test to rule out any theme/plugin conflicts.

    To test, you’ll first want to change the theme on your site to Storefront, then check to see if the issue is still present. If that resolves the issue, you’ll want to get in touch with your theme’s developer and see if they have an update or fix for you.

    If changing the theme doesn’t help, you’ll want to deactivate all plugins except for WooCommerce and take a look. If that fixes the problem, re-enable the other plugins one by one (gradually), checking after each, to see where the issue is coming from.

    If you don’t want to test on your live site, then create a staging site using a plugin called WP Staging.

    Should the issue persist, please could you share a copy of the following, as I’d like to gain a better understanding of your sites current environment:

    • System Status Report: navigate to WooCommerce → Status. Select Get system report and then Copy for support.
    • Fatal Error log: Share a copy of any fatal error log found under WooCommerce → Status → Logs.

    Once you have these, please share them in your response here.

    Cheers!

    This error is generated when SVGs are used, even outside of WooCommerce. This isn’t a server PHP version issue.

    WooCommerce is trying to regenerate images in class-wc-regenerate-images.php in the maybe_resize_image method on line 201. Since SVGs don’t have a width/height attribute, the array keys don’t exists.

    To fix this before WC can fix their code, you can set the filter woocommerce_resize_images to false.

    The code:

    add_filter('woocommerce_resize_images', static function() {
        return false;
    });

    This can be added to your functions.php in your theme.

    Thread Starter wpreceiver

    (@wpreceiver)

    Hi @disinfor,

    Can I disable this resize images only for SVG files? Because I haven’t use any SVG images related to WooCommerce. Those SVGs are icons based.

    Thanks

    @wpreceiver you shouldn’t need that filter at all, since WordPress core already resizes images. That filter shouldn’t affect anything you need.

    Roxy

    (@roxannestoltz)

    Hi @wpreceiver ,

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – we’ll be here if you need any further help with this.

    Cheers!

    Thankyou for your post @disinfor – your suggestion worked? ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘I am getting this warning’ is closed to new replies.