WordPress / WordPress/secure-custom-fields
JS core utility edge cases: acf.get() falsy values, acf.isObject(null), acf._e() leaking String.prototype methods
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 131
- Forks
- 64
- Avg merge
- 10m
- Merged PRs (30d)
- 1
Description
Description
Three related edge cases in the core acf JS utilities (assets/src/js/_acf.js), grouped because fixes would land together:
acf.get()cannot return falsy stored values: it returnsthis.data[name] || null, so stored0,'', orfalsecome back asnull, andacf.has()reports them missing.acf.isObject( null ) === true:typeof null === 'object'.acf._e( 'missing', 'sub' )returnsString.prototype.sub: when the first key is unknown, the lookup indexes into an empty string, so any second key naming a String method leaks that function instead of returning''.
All three are long-standing characterized behavior; fixing them changes the public API surface subtly, so each needs a quick ecosystem-impact look (e.g. code relying on get() || default patterns is unaffected by 1).
Reproduction
Characterized in #450: tests/js/acf-utilities.test.js (NOTE comments at the get()/isObject() cases) and tests/js/compatibility.test.js (_e() case).
Found during the 2026-06 test campaign (see PR #450).
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 with assets/src/js/_acf.js and run tests/js/acf-utilities.test.js plus tests/js/compatibility.test.js. Review the characterized cases from #450 and the related API usage, then update the utility behavior and tests so falsy values, null object checks, and unknown _e() lookups behave as specified without breaking compatibility.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100