AdvancedCustomFields / AdvancedCustomFields/acf

acf_get_fields function access array indexes 'key' and 'ID' without checking their existence

Open
#266 16 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
945
Forks
197
PR merge metrics
No merged PRs in 30d

Description

After updating from 5.7.10 to 5.8.0, I get the following notices:

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

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

This is usually not a problem, but when trying to use with other plugins like https://www.wpgraphql.com/acf

It causes an issue where my graphql endpoint breaks because of this function.

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

This issue has already been reported in the support forums:
https://support.advancedcustomfields.com/forums/topic/acf-field-functions-php349-undefined-index-key/

And the solution for it has been posted but no PR was ever created.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect acf_get_fields in includes/acf-field-functions.php around lines 349 and 361, then reproduce the notices with flexible content using cloned ACF field groups as layouts. Done means the missing array indexes no longer generate notices and the affected GraphQL endpoint continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, php
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.