Support

Account

Home Forums Bug Reports acf-field-functions.php:349 – Undefined index: key

Solving

acf-field-functions.php:349 – Undefined index: key

  • After updating from 5.7.10 to 5.8.0, I get the follow notice:

    Notice: Undefined index: key in /plugins/advanced-custom-fields-pro/includes/acf-field-functions.php on line 349

    It doesn’t seem to cause any issues other than throwing the notice. Any insight on how to resolve this?

    ACF Pro version: 5.8.0
    PHP version: 7.1.20
    ACF Implementation: Flexible content component using cloned ACF field groups as layouts.

    Thanks!

  • I didn’t update to 5.7.11 because of the issues outlined in the following thread: (Update 5.7.11 Crashes Site) https://support.advancedcustomfields.com/forums/topic/update-5-7-11-crashes-site/

    The site no longer crashes, but the Notice is still an issue.

  • Same here:

    Notice: Undefined index: key in .../acf-field-functions.php on line 349

    I switched off the WP_DEBUG_DISPLAY for now.

  • I opened a support ticket and got a response from the ACF team stating that they could not recreate the issue. At this point, I’ve just turned debug logging off as well.

  • Thanks for the info.

    I’ve got over 60 field groups, some of them are flexible fields with several of the other field groups as clones inside their flexible field layouts.

    Notices started to pop up after I’ve duplicated the field groups via WPML (WordPress Multilingual Plugin) functionality to make the field groups available in other languages.

    I did not consider the hierarchy of the fields while duplicating them. Meaning: I should have duplicated the ones which are used as clones first. And only after duplicating all the basic field groups I should have started with duplicating the rather complex ones.

    –> Might be the reason why I get these notices now.

  • The line that’s causing your issue indicates that the field group does not have a key, which should be impossible.

    As far as the duplicated groups for wpml and clone field. I don’t know how this works, but it could be that the duplicated groups that include cloned groups the key of the cloned group was not set correctly. I would try to edit these duplicated groups and check the clone field, maybe updating these will work?

  • Hi John,

    Thanks for your answer. Updating the fields didn’t help, so I went full circle:

    When I ditched the database and kinda “started from scratch” concerning the db (synchronizing all fields from the json files), the errors did not occur again.

    So I’m guessing: Might have been a minor glitch which might have nested itself in the db when I duplicated the fields into another language.
    –> Somewhere there/towards your assumption:

    it could be that the duplicated groups that include cloned groups the key of the cloned group was not set correctly

    Concerning this bug report: I’m good. I don’t think I’ll run into these notices again any time soon.

    Cheers

  • I am experiencing the same issue after upgrading from 5.7.10 to 5.8.0.

    Like the original author of this post, I use flexible layout fields, cloning other field groups in for each layout option.

  • Just adding the QueryMonitor debug output for reference (see attached). Happy to share additional details if helpful.

    • mg.drs

    • August 6, 2019 at 7:41 pm

    I had the same issue without using WPML or other plugins.
    The Problem was a field group (A) i used in another group (B) via clone.
    After deleting (A), the error occurs, because (B) was referencing a deleted field group. After deleting the cloned group from (B) the error disappears and everything was fine.

    • Pacart

    • August 16, 2019 at 8:45 pm

    Hi,

    I have the same issue.
    I’m using a repeater of field group clones.
    In the “acf_get_fields” function, in line 356 of the acf-field-functions.php file (version 5.8.3), the parent value is an array of groups of fields, so they have no key or id.

    If you could add a presence check before calling $parent[‘key’] or $parent[‘id’] respectively to lines 349 and 356, this will resolve the notices.

    Thanks

  • Props to Pacart. –> Sounds like a plan!

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.