Support

Account

Home Forums General Issues Illegal offset type in isset or empty

Unread

Illegal offset type in isset or empty

  • I keep getting this error pop up and I’ve been trying to trace is back to the root but everything seems fine.

    The full error looks like:

    Warning: Illegal offset type in isset or empty in advanced-custom-fields-pro\includes\class-acf-data.php on line 94 and 110

    The problem is that it’s testing against an array which turns out to be the value I need returned. If I run a debug backtrace on 110 when passed an array as the name I get it running through the following functions with the following arguments.

    – get_field( ‘my_key’, ‘term_123’ )
    —- My Function Call
    – acf_maybe_get_field( ‘my_key’, ‘term_123’ )
    —- \includes\api\api-template.php LN 27
    – acf_get_meta_field( ‘my_key’, ‘term_123’ )
    —- includes\api\api-template.php LN 177

    This is where the trouble starts, from that point on the passed arguments is an array. So I jump into acf_get_meta_field() and down the rabbit hole I go. I get all the way to acf_get_reference() in acf-value-functions.php LN 18 and here’s the input & output:

    acf_get_reference gets passed my proper $field_name and $post_id ( ‘my_key’, ‘term_123’ ) and it hits acf_get_metadata() with this info and returns the array. All of this seems right.

    The calling function (acf_get_meta_field) expects a $field_key in return though.

    $field_key = acf_get_reference( $key, $post_id );

    And what is returned is an array of values. The array of values then gets passed down to acf_get_field() which as $id. Then it hits the $store->has() conditional and falls apart.

    @param (int|string) $id The field ID, key or name.

    I understand the issue is likely on my end of things but I’m having trouble determining _where_ that disconnect is happening and am reaching out here for insight. This field is a term field and the taxonomy exists on multiple post types with terms assigned to multiple posts of different types.

    Any ideas, things I can try? I don’t mind adding breakpoints to the plugin as they won’t be permanent to try and figure out where the issue is rooted and fix it.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.