AdvancedCustomFields / AdvancedCustomFields/acf
Conflicting key names in ACF_Data store and acf_get_value
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 945
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
The acf_get_value() method uses the field['name'] as the key in the values store. I'm finding that this can results in naming conflicts if more than one field uses the same field name. When more than one field with the same name are loaded within the same session, acf_get_value() will return the cached stored value of the previously loaded field.
Could this issue be avoided by using the unique field['key'] value as the key in the values store?
Thank you for your excellent work with ACF.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing acf_get_value() and the ACF_Data values store, focusing on how field['name'] is used as the cache key. Reproduce the conflict with two fields sharing a name but having different field['key'] values, then verify that each field retrieves its own stored value when the issue is fixed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100