• Howdy folks!

    Recently, I am seeing the error below:


    [24-Jun-2025 12:45:49 UTC] PHP Warning: Trying to access array offset on value of type bool in /home/.../wp-content/plugins/judgeme-product-reviews-woocommerce/includes/class-jgm-productservice.php on line 329

    it’s related to the block starting on lines 320-330.

    $product = array(
    'id' => $id,
    'title' => $title,
    'handle' => $handle,
    'vendor' => $vendor, //Should not require vendor!!
    'in_store' => $in_store,
    'image_url' => $image_url[0],
    'small_image_url' => $small_image_url[0],
    'medium_image_url' => $medium_image_url[0],
    'tags' => implode( ', ', $term_array ),
    'path' => str_replace(home_url(), '', get_permalink($id)),
    );

    I believe that we need to check if it’s really returning an array to avoid bool, something like:

    'image_url'        => is_array($image_url) ? $image_url[0] : '',
    'small_image_url' => is_array($small_image_url) ? $small_image_url[0] : '',
    'medium_image_url' => is_array($medium_image_url) ? $medium_image_url[0] : '',

    Would it be possible for you folks to take a look at it and provide an official fix?
    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support mbarekame

    (@mbarekame)

    Hello,

    Thanks for reaching out and sharing the PHP warning:

    We’ve reviewed this line in our plugin code, but we haven’t been able to reproduce this exact issue on our end or see it in our logs so far.

    To help us investigate further, could you please let us know:

    • When or under what circumstances do you see this error? (e.g. when syncing reviews, saving a product, visiting a certain admin page, etc.)
    • Does this warning appear consistently or only occasionally?
    • Have you noticed any impact on the functionality of the Judge.me plugin (e.g. missing reviews, sync issues, UI problems, etc.)?

    This information will help us pinpoint whether this is just a non-blocking warning or if it affects functionality.

    Let us know if you have any questions!

    Thread Starter aetta

    (@chiape)

    Hey there! Thanks for the fast reply!

    This seems to happen occasionally and in batches. What I’ve identified is that sometimes the product doesn’t have a featured image or the review doesn’t have an attached image (perhaps related to the product?).

    In any case, it appears the plugin is always assuming it will receive an array of URL/image, and when it doesn’t, it gets false and $image_url becomes a boolean.

    Forcing the use of an image placeholder may solve the issue too (but this isn’t something I can do at the moment)

    Thanks

    Plugin Support mbarekame

    (@mbarekame)

    Hello,

    Thank you for sharing the details with us.

    We haven’t been able to replicate the issue yet. However, we will continue to investigate this with our developers.

    If you have any questions please let us know.

    Thread Starter aetta

    (@chiape)

    Fantastic! Let me know if you need anything else on my end!

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘PHP Warning rying to access array offset on value of type bool’ is closed to new replies.