You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upon using the "Save Progress" form feature in Gravity Forms along with an email Add-On provider there should be no warnings/issues thrown.
Actual Behavior
A warning/notice is thrown because the email Add-On provider tries to create an entry note on a partial entry (which have no proper "entry_id" as they're saved in a separate "gf_draft_submissions" table), so the note-related actions/filters are still run by the email Add-On but provide said hooks with "null" instead of a proper "entry/lead id", and since there's no check in the Stream connector class for if the entry/lead id is a valid int it leads to the "$lead" on line 675 being set to "false" and then treated subsequently as an array:
[12-Sep-2023 23:58:38 UTC] PHP Warning: Trying to access array offset on value of type bool in /../public_html/wp-content/plugins/stream/connectors/class-connector-gravityforms.php on line 676
[12-Sep-2023 23:58:38 UTC] PHP Warning: Trying to access array offset on value of type null in /../public_html/wp-content/plugins/stream/connectors/class-connector-gravityforms.php on line 684
[12-Sep-2023 23:58:38 UTC] PHP Warning: Trying to access array offset on value of type null in /../public_html/wp-content/plugins/stream/connectors/class-connector-gravityforms.php on line 685
/* translators: %1$d: an ID, %2$d: another ID, %3$s: a form title (e.g. "42", "7", "Contact Form") */
__( 'Note #%1$d added to lead #%2$d on "%3$s" form', 'stream' ),
array(
'note_id' => $note_id,
'lead_id' => $lead_id,
'form_title' => $form['title'],
'form_id' => $form['id'],
),
$note_id,
'notes',
'added'
);
}
The fix should be as simple as checking if "$lead_id" in the above method is empty and returning early if that's the case. A further check on the whether the "$lead" variable is a valid array will also be needed as "\GFFormsModel::get_lead" can return a boolean if no entry is found for whatever reason.
I'll open a PR regarding this issue shortly
Steps to Reproduce the Problem
Set PHP error_reporting to include notices & warnings
Install Gravity Forms, SendGrid Add-On, and Partial Entries Add-On
Setup small test form, in the Form Settings enable "Enable Save and Continue", and enable the "Partial Entries" feature for it as well
Set the "Save & continue notification email" to use the Add-On email providers instead of the built-in "WordPress" one
Visit form and attempt to use the "Save Progress" feature
Check confirmation message or PHP debug log for above Warnings or Notices
Screenshots
Just a quick thing to point out is that when using the default "WordPress" email provider service for this Save & continue notification email it works as it should & no warning/notice is thrown, and that's because GF calls this internal method which explicitly checks for whether the "$entry_id" is empty or not before it tries to create a note, and most email Add-On providers seem to skip this check before trying to create a note.
In GF file "forms_model.php":
System Information
Stream plugin version: 3.9.3
WordPress version: 6.3.1
PHP version: 8.1.23
Browser: Google Chrome | 117.0.5938.62
Computer operating system: macOS Version 13.5.2 (Build 22G91)
The text was updated successfully, but these errors were encountered:
Bug Report
Expected Behavior
Upon using the "Save Progress" form feature in Gravity Forms along with an email Add-On provider there should be no warnings/issues thrown.
Actual Behavior
A warning/notice is thrown because the email Add-On provider tries to create an entry note on a partial entry (which have no proper "entry_id" as they're saved in a separate "gf_draft_submissions" table), so the note-related actions/filters are still run by the email Add-On but provide said hooks with "null" instead of a proper "entry/lead id", and since there's no check in the Stream connector class for if the entry/lead id is a valid int it leads to the "$lead" on line 675 being set to "false" and then treated subsequently as an array:
File/location of issue:
stream/connectors/class-connector-gravityforms.php
Lines 657 to 691 in 4fb568d
The fix should be as simple as checking if "$lead_id" in the above method is empty and returning early if that's the case. A further check on the whether the "$lead" variable is a valid array will also be needed as "\GFFormsModel::get_lead" can return a boolean if no entry is found for whatever reason.
I'll open a PR regarding this issue shortly
Steps to Reproduce the Problem
Screenshots
Just a quick thing to point out is that when using the default "WordPress" email provider service for this Save & continue notification email it works as it should & no warning/notice is thrown, and that's because GF calls this internal method which explicitly checks for whether the "$entry_id" is empty or not before it tries to create a note, and most email Add-On providers seem to skip this check before trying to create a note.
In GF file "forms_model.php":
System Information
The text was updated successfully, but these errors were encountered: