Skip to content

Fix guard against null field values and ACF component mismatches - #61

Open
manuel-be-one wants to merge 1 commit into
Bynder:mainfrom
manuel-be-one:fix/improve-sync-stability
Open

Fix guard against null field values and ACF component mismatches#61
manuel-be-one wants to merge 1 commit into
Bynder:mainfrom
manuel-be-one:fix/improve-sync-stability

Conversation

@manuel-be-one

Copy link
Copy Markdown

✍️ Description

💡 What does this PR do?

  • Guard $field_value emptiness before accessing $field_value[0]->label in the otherOption path of radio/checkbox fields (base.php, also falls back to $option->optionId if label is not set
  • Guard array_combine() in set_acf_field_value() (push.php): skip rows where $componentFieldsKeys count does not match the ACF group values count, and log the mismatch instead of throwing a fatal error

❓ Why are we doing this?

  • On templates where radio or checkbox fields have an empty otherOption, $field_value can be null, causing a TypeError on $field_value[0]->label that silently killed the sync.
  • On ACF component mappings where the number of fields declared in Content Workflow does not match the number of values in the ACF group, calling array_combine() with mismatched arrays throws a ValueError and leaves the item stuck in an "in progress" push state with a 500 error.

:shipit:

Adds defensive checks to prevent PHP errors such as undefined offsets, empty variable access, and array_combine mismatches in sync-related classes, improving overall robustness.
@manuel-be-one manuel-be-one changed the title fix(sync): guard against null field values and ACF component mismatches Fix guard against null field values and ACF component mismatches Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant