#13 _convertToAny does not encode values correctly for writes

open
nobody
PHP SForce (3)
5
2007-03-06
2007-03-06
Anonymous
No

Reproduce

Include a field value that contains an ampersand (&). eg url__c = http://google.com/?blah&blah in an update/upsert/create call.

Patch

As I don't know the specifics of what should or should not be encoded, I just used the XMLWriter. Obviously, there is a slight performance hit with this method.

private function _convertToAny($fields) {
$XML = new XMLWriter();
$XML->openMemory();
foreach ($fields as $key => $value) {
$XML->writeElement($key, $value);
}

return $XML->outputMemory(TRUE);
}

Alternatively, you could probably just htmlentities() the value to form valid xml.

Discussion