There is a bug with the Gravity Forms GFAPI::submit_form
method when the $_POST
variable contains any existing values that match what you pass to GFAPI::submit_form
.
Because GFAPI::submit_form internally uses array_merge_recursive
, any existing values in the $_POST
variable will be added to any values that exist in the second parameter that you pass to GFAPI::submit_form
.
This bug appears in the latest version of Gravity Forms 2.4.20.5 and in the latest 2.5 beta.
UPDATE ON 07/14/2023: This is a known bug in Gravity Forms and the plugin developers (i.e. Rocket Genius) are aware of it. Since other developers have made custom workaround to get around this issue, patching this bug would break that custom code, so Rocket Genius has not patched it. This code is probably present in the latest version of the plugin and will probably be present in all future versions.