Potential data loss on large forms
On large forms, fields may be dropped before form processing potentially resulting in data loss.
If the number of fields in the form submission exceeds the
max_input_vars php setting (1000 by default) then
$_POST is truncated. The problem was noticed with the 'Update multiple contacts' action and a profile with 13 fields - see https://civicrm.stackexchange.com/questions/39588/update-multiple-contacts-failing
- Check that
max_input_varshas the default of 1000
- Create a custom field set with 12 fields and a profile with them all.
- Search for contacts, select 100, then the 'update multiple contacts' action and the profile just created
- Add some data & save.
Note that the last records are not updated correctly. Depending on the field type, existing data may be removed by the update, not just that new data fails to save.
max_input_vars = 2000 to php.ini, restart php/apache (depending on your config) and repeat. Should be ok.
All data should be processed correctly.
- CiviCRM: Master
- PHP: 7.3
- CMS: Drupal 7.80.
When this occurs an E_WARNING is issued by php according to the documentation. It may be possible to capture that and respond appropriately.
Alternatively, forms (or those that might be big ones) could include a field with the expected number of fields and processing would check the actual number of fields against the expected number.
Somehow we should avoid processing forms where the incoming fields have been truncated.