Advanced search gives fatal error if select a group and missing group on contact edit
Also happening on dmaster.demo.
Seems related to #1885 (closed) and the same commit https://github.com/civicrm/civicrm-core/pull/13958/files
If I revert it then it works. But the revert is not clean and needed to be done manually, so I'm not sure if that's just my lack of git-fu or if there's something that came later that reverting might now break.
Also copying over info from 1885:
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).