Skip to content

Fix fatal TypeError when replaying missed API requests referencing removed form fields - #893

Open
rodrigo-arias wants to merge 1 commit into
WebDevStudios:mainfrom
rodrigo-arias:fix/missed-api-request-replay-null-custom-field
Open

Fix fatal TypeError when replaying missed API requests referencing removed form fields#893
rodrigo-arias wants to merge 1 commit into
WebDevStudios:mainfrom
rodrigo-arias:fix/missed-api-request-replay-null-custom-field

Conversation

@rodrigo-arias

@rodrigo-arias rodrigo-arias commented Aug 14, 2026

Copy link
Copy Markdown

Fixes a fatal that makes reconnection impossible when ctct_missed_api_requests contains submissions queued before a form's fields were edited.

Problem

On reconnect, clear_missed_api_requests() replays the queue through set_contact_properties(), which re-resolves each custom field against the form's current definitions. Stale field hashes no longer resolve, so $custom_field['name'] passes null into the strictly-typed custom_field_exists():

Uncaught TypeError: ConstantContact_Client::custom_field_exists(): Argument #1 ($field_name) must be of type string, null given, called in includes/class-api.php on line 1051

Since the fatal happens mid-replay the queue is never pruned, so every reconnect attempt crashes — and ctct_acquiring_token is left stuck at 'true'.

Steps to reproduce

  1. Queue a submission while the API is down.
  2. Edit that form's fields.
  3. Reconnect.

Fix

Skip fields that no longer exist on the form instead of fataling. Verified on a production site with a 61-entry queue.

Related

Full analysis, including two related issues (per-field custom_fields reset dropping all but the last custom field; all-or-nothing queue persistence losing progress on timeout): https://wordpress.org/support/topic/fatal-typeerror-replaying-missed-api-requests-after-a-forms-fields-were-edited/

… custom fields

When clear_missed_api_requests() replays a queued submission after the
form's fields were edited, the stored field hashes no longer resolve in
get_original_fields(), so $custom_field['name'] passes null into the
strictly-typed ConstantContact_Client::custom_field_exists(), fataling
mid-replay. The queue is never pruned, so every subsequent reconnect
crashes the same way.

Skip fields that no longer exist on the form instead of fataling.
daveromsey added a commit that referenced this pull request Aug 18, 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