diff options
Diffstat (limited to 'vendor/sabre/xml/lib/Reader.php')
-rw-r--r-- | vendor/sabre/xml/lib/Reader.php | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/vendor/sabre/xml/lib/Reader.php b/vendor/sabre/xml/lib/Reader.php index 7cba76c59..f35dc8537 100644 --- a/vendor/sabre/xml/lib/Reader.php +++ b/vendor/sabre/xml/lib/Reader.php @@ -142,7 +142,12 @@ class Reader extends XMLReader { // choice. See: // // https://bugs.php.net/bug.php?id=64230 - if (!@$this->read()) return false; + if (!@$this->read()) { + if (!is_null($elementMap)) { + $this->popContext(); + } + return false; + } while (true) { @@ -152,6 +157,9 @@ class Reader extends XMLReader { if ($errors) { libxml_clear_errors(); + if (!is_null($elementMap)) { + $this->popContext(); + } throw new LibXMLException($errors); } } @@ -170,6 +178,9 @@ class Reader extends XMLReader { $this->read(); break 2; case self::NONE : + if (!is_null($elementMap)) { + $this->popContext(); + } throw new ParseException('We hit the end of the document prematurely. This likely means that some parser "eats" too many elements. Do not attempt to continue parsing.'); default : // Advance to the next element @@ -282,8 +293,13 @@ class Reader extends XMLReader { */ function getDeserializerForElementName($name) { + if (!array_key_exists($name, $this->elementMap)) { - return ['Sabre\\Xml\\Element\\Base', 'xmlDeserialize']; + if (substr($name, 0, 2) == '{}' && array_key_exists(substr($name, 2), $this->elementMap)) { + $name = substr($name, 2); + } else { + return ['Sabre\\Xml\\Element\\Base', 'xmlDeserialize']; + } } $deserializer = $this->elementMap[$name]; |