Invalid and patchy XML encoding causes Case crash if status is not valid XML
CiviCase will fail to fully create a CaseType if a Case Status' name is invalid in an XML context.
- Create case status 'Signed & Sealed'
- Create case type
- Got an error about XML encoding
The form errors and won't save. Yet it has half created a Case - it's there but has no description. This is massively confusing because it looks like it might have worked, but creates havock if you actually try to use that case type.
It should create the case type without error.
This happens because of some incomplete and rather lets-do-it-ourselves XML encoding. There's even a comment in the code saying "Ugh!" about this!
The Statuses element was being written without being encoded, therefore
& becomes an invalid entity.
I have a PR for this that replaces the homemade XML encoding function with PHP's built in XML Writer objects.