Update core 8.3.0
This commit is contained in:
parent
da7a7918f8
commit
cd7a898e66
6144 changed files with 132297 additions and 87747 deletions
|
@ -92,14 +92,16 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
|
|||
throw new UnexpectedValueException($error->message);
|
||||
}
|
||||
|
||||
$rootNode = null;
|
||||
foreach ($dom->childNodes as $child) {
|
||||
if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) {
|
||||
throw new UnexpectedValueException('Document types are not allowed.');
|
||||
}
|
||||
if (!$rootNode && $child->nodeType !== XML_PI_NODE) {
|
||||
$rootNode = $child;
|
||||
}
|
||||
}
|
||||
|
||||
$rootNode = $dom->firstChild;
|
||||
|
||||
// todo: throw an exception if the root node name is not correctly configured (bc)
|
||||
|
||||
if ($rootNode->hasChildNodes()) {
|
||||
|
@ -329,6 +331,10 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
|
|||
$value = array();
|
||||
|
||||
foreach ($node->childNodes as $subnode) {
|
||||
if ($subnode->nodeType === XML_PI_NODE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$val = $this->parseXml($subnode);
|
||||
|
||||
if ('item' === $subnode->nodeName && isset($val['@key'])) {
|
||||
|
@ -369,7 +375,10 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
|
|||
if (is_array($data) || ($data instanceof \Traversable && !$this->serializer->supportsNormalization($data, $this->format))) {
|
||||
foreach ($data as $key => $data) {
|
||||
//Ah this is the magic @ attribute types.
|
||||
if (0 === strpos($key, '@') && is_scalar($data) && $this->isElementNameValid($attributeName = substr($key, 1))) {
|
||||
if (0 === strpos($key, '@') && $this->isElementNameValid($attributeName = substr($key, 1))) {
|
||||
if (!is_scalar($data)) {
|
||||
$data = $this->serializer->normalize($data, $this->format, $this->context);
|
||||
}
|
||||
$parentNode->setAttribute($attributeName, $data);
|
||||
} elseif ($key === '#') {
|
||||
$append = $this->selectNodeType($parentNode, $data);
|
||||
|
@ -474,7 +483,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
|
|||
} elseif ($val instanceof \Traversable) {
|
||||
$this->buildXml($node, $val);
|
||||
} elseif (is_object($val)) {
|
||||
return $this->buildXml($node, $this->serializer->normalize($val, $this->format, $this->context));
|
||||
return $this->selectNodeType($node, $this->serializer->normalize($val, $this->format, $this->context));
|
||||
} elseif (is_numeric($val)) {
|
||||
return $this->appendText($node, (string) $val);
|
||||
} elseif (is_string($val) && $this->needsCdataWrapping($val)) {
|
||||
|
|
Reference in a new issue