Repository navigation
fix(acf): a flexible content row is read with its own layout; a key and name for one sub-field is reported - #61
Merged
Merged
Conversation
…nd name for one sub-field is reported Source::acf_value merged every layout's sub-fields into one lookup, so a sub-field name two layouts share (each with its own type) resolved to the last layout's definition for every row. A row now uses the layout its acf_fc_layout names; only a row whose layout is unknown falls back to the union, as before. A row holding a sub-field under both its key and its name kept the later cell silently. It still keeps the later cell, and the overwrite is now reported as acf-key-name-collision. Closes #45
… layout's fields; the collision report names the kept and dropped cell With the row's own layout as the only lookup, a cell keyed by another layout's field key matched nothing and passed through untyped as acf-key-unmapped, so a password sub-field from another layout could leak. The row's layout is now looked up first and every other cell falls back to the all-layouts lookup main always used, so a secret type is still removed. acf-key-name-collision now says which cell was kept and which dropped. Refs #45
Member
Author
|
ONAY (t8) @ 5515861 — lean review, per the founder's "product first" order.
|
This was referenced Oct 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #45.
Label: GENERIC. This is ACF/SCF flexible content and keyed-row handling in
Source::acf_value, used by every site whose flexible layouts reuse a sub-field name. It is not tied to one builder or theme.What changes (
includes/class-contentrain-bridge-source.php)acf_fc_layout. Before, the sub-fields of every layout were merged into one lookup by name, so a name that two layouts share resolved to the last layout's definition for every row. That could mean the wrong type, or a field judged secret, or one that wasn't. Now a row whoseacf_fc_layoutnames a known layout looks its cells up in that layout first. Any cell that layout does not define (for example another layout's field key), and every cell of a row with no or an unknown layout, falls back to the all-layouts lookup main uses, so it is still typed and a secret type is still removed (fail-closed; 5515861, review follow-up).field_…) and its name kept the later cell silently. It still keeps the later cell, so output is unchanged, and it now reports{source: <path>/<name>, reason: 'acf-key-name-collision: kept <cell>, dropped <cell>'}in the excluded list, next toacf-key-unmapped, using the existingreason: detailconvention.Tests (
tests/integration.php, 2 new checks)media, one asimageand one aspassword. Theherorow keepsmedia: 42and thenoterow'smediais removed as sensitive. With the old union lookup the hero value was dropped too, so this check fails on main.field_soc_labelandlabelkeeps the later cell and reports exactly oneacf-key-name-collision: kept label, dropped field_soc_label.herorow carryingfield_note_media(thenotelayout's password key) with the valuehunter2: the cell is removed assensitive-field, the value appears nowhere in the output, and noacf-key-unmappedis reported. This check fails against the layout-only lookup of the first commit (verified by running the suite on that code).Checks (local, clean stack:
down -v, thenKEEP=1)npm run test:wordpress: 397 checks passed (main has 394, plus these 3)npm test: 13/13npm run test:reader: passnpm run test:plugin: Plugin Check 0 errors, 4 warnings (the four known WPML hook names)php -lon all 59 PHP files: no errorsNo version bump or changelog entry here. Add them at the next release.