aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/xml/lib
diff options
context:
space:
mode:
authorKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2016-10-17 23:26:48 +0200
committerKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2016-10-18 18:11:41 +0200
commit745515b11f438d3658203aaaaf151c72e30d5e7c (patch)
treeed43b874f5519cf06a05a703e144fd6acad06d4b /vendor/sabre/xml/lib
parent17091bd38c4e4e5d8b1812dd1d9efeffe0046d02 (diff)
downloadvolse-hubzilla-745515b11f438d3658203aaaaf151c72e30d5e7c.tar.gz
volse-hubzilla-745515b11f438d3658203aaaaf151c72e30d5e7c.tar.bz2
volse-hubzilla-745515b11f438d3658203aaaaf151c72e30d5e7c.zip
[FEATURE] Add config and use composer autoloader.
We use composer already to install SabreDAV. Include config composer.(json|lock) to install and manage more dependencies in future. Also provide PSR-4 autoloading for our namespaced classes, e.g. "Zotlabs\". To regenerate autoloader maps use: $ composer install --optimize-autoloader --no-dev We could also remove the whole vendor/ folder from our repository, but that would need changes in deployment and how to install hubs and needs more discussion first.
Diffstat (limited to 'vendor/sabre/xml/lib')
-rw-r--r--vendor/sabre/xml/lib/Element/XmlFragment.php2
-rw-r--r--vendor/sabre/xml/lib/Reader.php122
-rw-r--r--vendor/sabre/xml/lib/Version.php2
-rw-r--r--vendor/sabre/xml/lib/Writer.php2
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
);