diff options
Diffstat (limited to 'vendor/sabre/xml/lib')
-rw-r--r-- | vendor/sabre/xml/lib/Element/XmlFragment.php | 2 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/Reader.php | 122 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/Version.php | 2 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/Writer.php | 2 |
4 files changed, 67 insertions, 61 deletions
diff --git a/vendor/sabre/xml/lib/Element/XmlFragment.php b/vendor/sabre/xml/lib/Element/XmlFragment.php index 0abfac132..642241ca4 100644 --- a/vendor/sabre/xml/lib/Element/XmlFragment.php +++ b/vendor/sabre/xml/lib/Element/XmlFragment.php @@ -2,9 +2,9 @@ namespace Sabre\Xml\Element; +use Sabre\Xml\Element; use Sabre\Xml\Reader; use Sabre\Xml\Writer; -use Sabre\Xml\Element; /** * The XmlFragment element allows you to extract a portion of your xml tree, diff --git a/vendor/sabre/xml/lib/Reader.php b/vendor/sabre/xml/lib/Reader.php index f35dc8537..92e5dba96 100644 --- a/vendor/sabre/xml/lib/Reader.php +++ b/vendor/sabre/xml/lib/Reader.php @@ -59,22 +59,26 @@ class Reader extends XMLReader { $previousEntityState = libxml_disable_entity_loader(true); $previousSetting = libxml_use_internal_errors(true); - // Really sorry about the silence operator, seems like I have no - // choice. See: - // - // https://bugs.php.net/bug.php?id=64230 - while ($this->nodeType !== self::ELEMENT && @$this->read()) { - // noop - } - $result = $this->parseCurrentElement(); + try { + + // Really sorry about the silence operator, seems like I have no + // choice. See: + // + // https://bugs.php.net/bug.php?id=64230 + while ($this->nodeType !== self::ELEMENT && @$this->read()) { + // noop + } + $result = $this->parseCurrentElement(); - $errors = libxml_get_errors(); - libxml_clear_errors(); - libxml_use_internal_errors($previousSetting); - libxml_disable_entity_loader($previousEntityState); + $errors = libxml_get_errors(); + libxml_clear_errors(); + if ($errors) { + throw new LibXMLException($errors); + } - if ($errors) { - throw new LibXMLException($errors); + } finally { + libxml_use_internal_errors($previousSetting); + libxml_disable_entity_loader($previousEntityState); } return $result; @@ -138,60 +142,62 @@ class Reader extends XMLReader { $this->elementMap = $elementMap; } - // Really sorry about the silence operator, seems like I have no - // choice. See: - // - // https://bugs.php.net/bug.php?id=64230 - if (!@$this->read()) { - if (!is_null($elementMap)) { - $this->popContext(); - } - return false; - } - - while (true) { - - if (!$this->isValid()) { + try { + // Really sorry about the silence operator, seems like I have no + // choice. See: + // + // https://bugs.php.net/bug.php?id=64230 + if (!@$this->read()) { $errors = libxml_get_errors(); - + libxml_clear_errors(); if ($errors) { - libxml_clear_errors(); - if (!is_null($elementMap)) { - $this->popContext(); - } throw new LibXMLException($errors); } + throw new ParseException('This should never happen (famous last words)'); } - switch ($this->nodeType) { - case self::ELEMENT : - $elements[] = $this->parseCurrentElement(); - break; - case self::TEXT : - case self::CDATA : - $text .= $this->value; - $this->read(); - break; - case self::END_ELEMENT : - // Ensuring we are moving the cursor after the end element. - $this->read(); - break 2; - case self::NONE : - if (!is_null($elementMap)) { - $this->popContext(); + while (true) { + + if (!$this->isValid()) { + + $errors = libxml_get_errors(); + + if ($errors) { + libxml_clear_errors(); + throw new LibXMLException($errors); } - 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 - $this->read(); - break; + } + + switch ($this->nodeType) { + case self::ELEMENT : + $elements[] = $this->parseCurrentElement(); + break; + case self::TEXT : + case self::CDATA : + $text .= $this->value; + $this->read(); + break; + case self::END_ELEMENT : + // Ensuring we are moving the cursor after the end element. + $this->read(); + break 2; + case self::NONE : + 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 + $this->read(); + break; + } + } - } + } finally { + + if (!is_null($elementMap)) { + $this->popContext(); + } - if (!is_null($elementMap)) { - $this->popContext(); } return ($elements ? $elements : $text); @@ -304,7 +310,7 @@ class Reader extends XMLReader { $deserializer = $this->elementMap[$name]; if (is_subclass_of($deserializer, 'Sabre\\Xml\\XmlDeserializable')) { - return [ $deserializer, 'xmlDeserialize' ]; + return [$deserializer, 'xmlDeserialize']; } if (is_callable($deserializer)) { diff --git a/vendor/sabre/xml/lib/Version.php b/vendor/sabre/xml/lib/Version.php index f199e7158..7edb40d67 100644 --- a/vendor/sabre/xml/lib/Version.php +++ b/vendor/sabre/xml/lib/Version.php @@ -14,6 +14,6 @@ class Version { /** * Full version number */ - const VERSION = '1.4.1'; + const VERSION = '1.5.0'; } diff --git a/vendor/sabre/xml/lib/Writer.php b/vendor/sabre/xml/lib/Writer.php index adfbe0cb0..09d4cb321 100644 --- a/vendor/sabre/xml/lib/Writer.php +++ b/vendor/sabre/xml/lib/Writer.php @@ -127,7 +127,7 @@ class Writer extends XMLWriter { if (array_key_exists($namespace, $this->namespaceMap)) { $result = $this->startElementNS( - $this->namespaceMap[$namespace] === '' ? null : $this->namespaceMap[$namespace], + $this->namespaceMap[$namespace] === '' ? null : $this->namespaceMap[$namespace], $localName, null ); |