From 7a1d79f5fb51f248d5e0b1eb9b0366f11ab6f8cc Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Fri, 14 Aug 2026 14:12:54 -0300 Subject: [PATCH] Prevent fatal TypeError when replaying missed API requests with stale 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. --- includes/class-api.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/class-api.php b/includes/class-api.php index 86bd3a2f..14377acb 100644 --- a/includes/class-api.php +++ b/includes/class-api.php @@ -1036,7 +1036,12 @@ public function set_contact_properties( $contact, $user_data, $form_id, $updated $original_field_data = $this->plugin->get_process_form()->get_original_fields( $form_id ); $custom_field_name = ''; $should_include = apply_filters( 'constant_contact_include_custom_field_label', false, $form_id ); - $custom_field = ( $original_field_data[ $original ] ); + $custom_field = $original_field_data[ $original ] ?? null; + + if ( ! is_array( $custom_field ) || empty( $custom_field['name'] ) ) { + break; // Queued request references a form field that no longer exists on the form. + } + $new_custom_field = ''; $contact['custom_fields'] = []; // @todo Fix me.