Escape special characters in XML.

Fixes #2188.
This commit is contained in:
Christian Hieke 2011-11-24 10:09:35 +01:00 committed by mark_story
parent 54aef7216f
commit a51626840e

View file

@ -200,7 +200,16 @@ class Xml {
continue;
}
if ($key[0] !== '@' && $format === 'tags') {
$child = $dom->createElement($key, $value);
$child = null;
if (!is_numeric($value)) {
// Escape special characters
// http://www.w3.org/TR/REC-xml/#syntax
// https://bugs.php.net/bug.php?id=36795
$child = $dom->createElement($key, '');
$child->appendChild(new DOMText($value));
} else {
$child = $dom->createElement($key, $value);
}
$node->appendChild($child);
} else {
if ($key[0] === '@') {