• Resolved Seanst3r

    (@seanst3r)


    This maybe has two parts. I have worked around it for myself so I can’t say for certain what I’m telling you is 100% true.

    I have images disabled and wc_bof_image_width/height is NULL
    However images are still being handled in some manner.

    I found hundreds of these in my debug log:
    PHP Warning: A non-numeric value encountered in wp-includes/media.php on line 647
    the function is wp_image_matches_ratio()

    The number of times this is called exceeds the number of images it should be handling so maybe some redundancy exists somewhere.

    As a workaround, I edited class-standard-product-search.php and removed this call:
    this->get_product_image( $id )
    (same deal with product_variation)

    With null size options, get_product_image() sets $size = ‘shop_thumbnail’;
    I would guess that is the non-numeric value that wp_image_matches_ratio() is complaining about. I didn’t test further as I have no desire to use images.

    -Sean

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hello Sean,
    The product images aren’t handled by the free version, and with the pro extension I do not get that PHP warning. Note that the second argument of the get_the_post_thumbnail_url function that we call can be either an array of numeric values or a named size (source, it actually defaults to a named size!). But it might be the difference between the setting being empty (but set) or being absent. I’ve changed it to !empty() instead of isset() which I think should resolve that issue. I have also added a check for the option so that it doesn’t try to fetch the image in the first place if the images are not enabled which is a nice improvement indeed – thanks for the heads-up!

    Ewout

    Plugin Contributor Ewout

    (@pomegranate)

    Could you confirm that the issue is indeed resolved in 3.0.4?

    Thread Starter Seanst3r

    (@seanst3r)

    Ok you seem cool so I did a little more testing and all is well.

    wc_bof_image_width’ => ”
    Null? empty string? php is not my native language.

    So yes, changing isset to !empty resolves that problem. I didn’t check if you make sure it’s a valid number when parsing options.

    $size = ‘shop_thumbnail’ is not a problem as you suggested.

    Wrapping the whole thing in wc_bof_option( ‘show_image’ ) certainly avoids it altogether.

    Regards,
    Sean

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘images disabled – bad function call arguments’ is closed to new replies.