E_WARNINGS on contact edit form related to groups
This came up the other day while reviewing a PR but I couldn't reproduce it, but now today I'm seeing it on dmaster.demo (and elsewhere) so I assume it's from a recent change somewhere.
When saving a new contact that does not have a group:
Warning: Invalid argument supplied for foreach() in CRM_Contact_BAO_Contact::create() (line 309 of /srv/buildkit/build/dmaster/web/sites/all/modules/civicrm/CRM/Contact/BAO/Contact.php).
When editing a contact that does have a group:
Warning: htmlspecialchars() expects parameter 1 to be string, array given in HTML_Common->_getAttrString() (line 144 of /srv/buildkit/build/dmaster/web/sites/all/modules/civicrm/packages/HTML/Common.php).
And then it doesn't show the group on the form and then when saving that contact:
Warning: array_key_exists() expects parameter 2 to be array, string given in CRM_Contact_Form_Contact->postProcess() (line 952 of /srv/buildkit/build/dmaster/web/sites/all/modules/civicrm/CRM/Contact/Form/Contact.php).