Created
October 25, 2013 16:55
-
-
Save stof/7157964 to your computer and use it in GitHub Desktop.
Fix for the error handler of the Symfony Xml decoding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php | |
index 137f2fc..dbc0a27 100644 | |
--- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php | |
+++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php | |
@@ -76,6 +76,10 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec | |
libxml_use_internal_errors($internalErrors); | |
libxml_disable_entity_loader($disableEntities); | |
+ if ($error = libxml_get_last_error()) { | |
+ throw new UnexpectedValueException($error->message); | |
+ } | |
+ | |
foreach ($dom->childNodes as $child) { | |
if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) { | |
throw new UnexpectedValueException('Document types are not allowed.'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment