Support

Account

Home Forums Add-ons Options Page warning: treating to access array offset on value of type bool – Image field

Helping

warning: treating to access array offset on value of type bool – Image field

  • Hi,

    I created a sub-page option to display pictograms in different places on the site.

    In this sub-option I created a group with several image fields inside these fields. For each field I checked the array option.

    When I add an image it works fine.
    On the other hand, when I do not add or delete an image from the field I get an error message that my bool returns false “warning: treating to access array offset on value of type bool”

    And this is where I don’t understand why.
    On php 7.4 I don’t have any error message, but on php 8 I have this message

    
       <?php
       $img = get_field('picto_group','option');
       if( !empty ($img)):
       // var_dump($img);
       ?>
       <img src="<?php echo $img ['img_button']['url']; ?>" />
       <?php endif;?>
    
  • exactly what type of field is “picto_group” and what are the settings?

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.