diff options
Diffstat (limited to 'vendor/sabre/xml')
-rw-r--r-- | vendor/sabre/xml/.travis.yml | 9 | ||||
-rw-r--r-- | vendor/sabre/xml/CHANGELOG.md | 11 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/Deserializer/functions.php | 7 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/Reader.php | 20 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/Service.php | 8 |
5 files changed, 48 insertions, 7 deletions
diff --git a/vendor/sabre/xml/.travis.yml b/vendor/sabre/xml/.travis.yml index 19a61a2c8..9bba4d451 100644 --- a/vendor/sabre/xml/.travis.yml +++ b/vendor/sabre/xml/.travis.yml @@ -4,6 +4,7 @@ php: - 5.5 - 5.6 - 7 + - nightly - hhvm matrix: @@ -11,10 +12,14 @@ matrix: sudo: false -cache: vendor +cache: + directories: + - $HOME/.composer/cache script: - ./bin/phpunit --configuration tests/phpunit.xml.dist - ./bin/sabre-cs-fixer fix . --dry-run --diff -before_script: composer install +before_script: + - phpenv config-rm xdebug.ini; true + - composer install diff --git a/vendor/sabre/xml/CHANGELOG.md b/vendor/sabre/xml/CHANGELOG.md index 3d8eb0fcb..a8085401b 100644 --- a/vendor/sabre/xml/CHANGELOG.md +++ b/vendor/sabre/xml/CHANGELOG.md @@ -1,6 +1,17 @@ ChangeLog ========= +1.4.2 (????-??-??) +------------------ + +* The `contextStack` in the Reader object is now correctly rolled back in + error conditions (@staabm). +* repeatingElements deserializer now still parses if a bare element name + without clark notation was given. +* `$elementMap` in the Reader now also supports bare element names. +* `Service::expect()` can now also work with bare element names. + + 1.4.1 (2016-03-12) ----------------- diff --git a/vendor/sabre/xml/lib/Deserializer/functions.php b/vendor/sabre/xml/lib/Deserializer/functions.php index fe88a6db8..2e5d877e9 100644 --- a/vendor/sabre/xml/lib/Deserializer/functions.php +++ b/vendor/sabre/xml/lib/Deserializer/functions.php @@ -14,7 +14,7 @@ use Sabre\Xml\Reader; * deserializer functions. */ -/* +/** * The 'keyValue' deserializer parses all child elements, and outputs them as * a "key=>value" array. * @@ -213,7 +213,7 @@ function valueObject(Reader $reader, $className, $namespace) { } -/* +/** * This deserializer helps you deserialize xml structures that look like * this: * @@ -240,6 +240,9 @@ function valueObject(Reader $reader, $className, $namespace) { */ function repeatingElements(Reader $reader, $childElementName) { + if ($childElementName[0] !== '{') { + $childElementName = '{}' . $childElementName; + } $result = []; foreach ($reader->parseGetElements() as $element) { 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]; diff --git a/vendor/sabre/xml/lib/Service.php b/vendor/sabre/xml/lib/Service.php index b2603a4c7..09ee341cf 100644 --- a/vendor/sabre/xml/lib/Service.php +++ b/vendor/sabre/xml/lib/Service.php @@ -151,8 +151,14 @@ class Service { $r->contextUri = $contextUri; $r->xml($input); + $rootElementName = (array)$rootElementName; + + foreach ($rootElementName as &$rEl) { + if ($rEl[0] !== '{') $rEl = '{}' . $rEl; + } + $result = $r->parse(); - if (!in_array($result['name'], (array)$rootElementName, true)) { + if (!in_array($result['name'], $rootElementName, true)) { throw new ParseException('Expected ' . implode(' or ', (array)$rootElementName) . ' but received ' . $result['name'] . ' as the root element'); } return $result['value']; |