Support

Account

Home Forums Bug Reports ACF – PHP 7.4 ERROR

Solving

ACF – PHP 7.4 ERROR

  • hi all, i the plugin ACF in a PHP 7.4 and 7.3 Website.

    here the php 7.4 error:

    Notice
    : Trying to access array offset on value of type bool in
    /wp-content/plugins/advanced-custom-fields/includes/acf-field-group-functions.php
    on line
    321

    i hope you can fixed the problem. in the PHP 7.3 no error

  • Confirmed the same bug.
    Btw – with ACF 5.8.10 no such problems, but if try to update plugin via admin up to last version appears error (screenshot attached).

  • For PRO version also is not possible to update plugin when php version is 7.4, screenshot attached

  • Hi there!

    Any news on this? Since running on PHP 7.4, I also encounter this error:

    Notice: Trying to access array offset on value of type bool in […]/products.php on line 169

    The code itself is quite simple:

    
    167|  $field_object = get_field_object( 'p_props_' . $grp . '_' . $v );
    168|
    169|  if ( $field_object['type'] == 'true_false' ) :
    

    And what does this error actually mean? I can’t see any issue on the page besides the debug error message.

    Thanks for any help!

  • @mischnu finally some code.

    In your case get_field_object() is likely not finding the field object and returning false. get_field_object() using the field name will only work if there is a value stored for the current post in that field.

  • @hube2, thanks for your quick reply, I now see what’s going on. Two things:

    Firstly, the issue has obviously always been there, but only PHP 7.4 shows a notice.

    Secondly, maybe to help others:

    I have set up a field as yes/no toggle with ‘no’ as default value. Now when I create a new post and ‘no’ is already the right value for this field, then it won’t be created in the database on saving the post—as long as you don’t set it to ‘yes’, update the post, and set it back to ‘no’ again.

    So my solution here is to check if the field exists at all, and if not, assume it is ‘no’:

    
    $field_object = get_field_object( 'p_props_' . $grp . '_' . $v );
    
    if ( !$field_object ) :
      // Field doesn’t exist --> false
      // ...
    
    else :
      if ( $field_object['type'] == 'true_false' ) :
    

    Again, thank you very much!

  • Yes, this has always been there and what I’ve seen is that most people assume that valid data will be returned rather than verify all data assuming that it’s bad.

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

The topic ‘ACF – PHP 7.4 ERROR’ is closed to new replies.