[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.
This commit is contained in:
Klaus Weidenbach
2016-10-17 23:26:48 +02:00
parent 17091bd38c
commit 745515b11f
51 changed files with 2097 additions and 490 deletions

68
vendor/sabre/dav/composer.json vendored Normal file
View File

@@ -0,0 +1,68 @@
{
"name": "sabre/dav",
"type": "library",
"description": "WebDAV Framework for PHP",
"keywords": ["Framework", "WebDAV", "CalDAV", "CardDAV", "iCalendar"],
"homepage": "http://sabre.io/",
"license" : "BSD-3-Clause",
"authors": [
{
"name": "Evert Pot",
"email": "me@evertpot.com",
"homepage" : "http://evertpot.com/",
"role" : "Developer"
}
],
"require": {
"php": ">=5.5.0",
"sabre/vobject": "^4.1.0",
"sabre/event" : ">=2.0.0, <4.0.0",
"sabre/xml" : "^1.4.0",
"sabre/http" : "^4.2.1",
"sabre/uri" : "^1.0.1",
"ext-dom": "*",
"ext-pcre": "*",
"ext-spl": "*",
"ext-simplexml": "*",
"ext-mbstring" : "*",
"ext-ctype" : "*",
"ext-date" : "*",
"ext-iconv" : "*",
"lib-libxml" : ">=2.7.0",
"psr/log": "^1.0"
},
"require-dev" : {
"phpunit/phpunit" : "> 4.8, <=6.0.0",
"evert/phpdoc-md" : "~0.1.0",
"sabre/cs" : "~0.0.5",
"monolog/monolog": "^1.18"
},
"suggest" : {
"ext-curl" : "*",
"ext-pdo" : "*"
},
"autoload": {
"psr-4" : {
"Sabre\\DAV\\" : "lib/DAV/",
"Sabre\\DAVACL\\" : "lib/DAVACL/",
"Sabre\\CalDAV\\" : "lib/CalDAV/",
"Sabre\\CardDAV\\" : "lib/CardDAV/"
}
},
"support" : {
"forum" : "https://groups.google.com/group/sabredav-discuss",
"source" : "https://github.com/fruux/sabre-dav"
},
"bin" : [
"bin/sabredav",
"bin/naturalselection"
],
"config" : {
"bin-dir" : "./bin"
},
"extra" : {
"branch-alias": {
"dev-master": "3.1.0-dev"
}
}
}

View File

@@ -163,7 +163,7 @@ class Plugin extends DAV\ServerPlugin {
* @return bool
*/
function httpPOST(RequestInterface $request, ResponseInterface $response) {
$contentType = $request->getHeader('Content-Type');
list($contentType) = explode(';', $contentType);
if ($contentType !== 'application/x-www-form-urlencoded' &&
@@ -179,7 +179,7 @@ class Plugin extends DAV\ServerPlugin {
if ($this->server->emit('onBrowserPostAction', [$uri, $postVars['sabreAction'], $postVars])) {
switch ($postVars['sabreAction']) {
switch ($postVars['sabreAction']) {
case 'mkcol' :
if (isset($postVars['name']) && trim($postVars['name'])) {
@@ -221,7 +221,7 @@ class Plugin extends DAV\ServerPlugin {
if ($_FILES) $file = current($_FILES);
else break;
list(, $newName) = URLUtil::splitPath(trim($file['name']));
if (isset($postVars['name']) && trim($postVars['name']))
$newName = trim($postVars['name']);

47
vendor/sabre/event/composer.json vendored Normal file
View File

@@ -0,0 +1,47 @@
{
"name": "sabre/event",
"description": "sabre/event is a library for lightweight event-based programming",
"keywords": [
"Events",
"EventEmitter",
"Promise",
"Hooks",
"Plugin",
"Signal",
"Async"
],
"homepage": "http://sabre.io/event/",
"license": "BSD-3-Clause",
"require": {
"php": ">=5.5"
},
"authors": [
{
"name": "Evert Pot",
"email": "me@evertpot.com",
"homepage": "http://evertpot.com/",
"role": "Developer"
}
],
"support": {
"forum": "https://groups.google.com/group/sabredav-discuss",
"source": "https://github.com/fruux/sabre-event"
},
"autoload": {
"psr-4": {
"Sabre\\Event\\": "lib/"
},
"files" : [
"lib/coroutine.php",
"lib/Loop/functions.php",
"lib/Promise/functions.php"
]
},
"require-dev": {
"sabre/cs": "~0.0.4",
"phpunit/phpunit" : "*"
},
"config" : {
"bin-dir" : "bin/"
}
}

43
vendor/sabre/http/composer.json vendored Normal file
View File

@@ -0,0 +1,43 @@
{
"name": "sabre/http",
"description" : "The sabre/http library provides utilities for dealing with http requests and responses. ",
"keywords" : [ "HTTP" ],
"homepage" : "https://github.com/fruux/sabre-http",
"license" : "BSD-3-Clause",
"require" : {
"php" : ">=5.4",
"ext-mbstring" : "*",
"sabre/event" : ">=1.0.0,<4.0.0",
"sabre/uri" : "~1.0"
},
"require-dev" : {
"phpunit/phpunit" : "~4.3",
"sabre/cs" : "~0.0.1"
},
"suggest" : {
"ext-curl" : " to make http requests with the Client class"
},
"authors" : [
{
"name" : "Evert Pot",
"email" : "me@evertpot.com",
"homepage" : "http://evertpot.com/",
"role" : "Developer"
}
],
"support" : {
"forum" : "https://groups.google.com/group/sabredav-discuss",
"source" : "https://github.com/fruux/sabre-http"
},
"autoload" : {
"files" : [
"lib/functions.php"
],
"psr-4" : {
"Sabre\\HTTP\\" : "lib/"
}
},
"config" : {
"bin-dir" : "bin/"
}
}

41
vendor/sabre/uri/composer.json vendored Normal file
View File

@@ -0,0 +1,41 @@
{
"name": "sabre/uri",
"description": "Functions for making sense out of URIs.",
"keywords": [
"URI",
"URL",
"rfc3986"
],
"homepage": "http://sabre.io/uri/",
"license": "BSD-3-Clause",
"require": {
"php": ">=5.4.7"
},
"authors": [
{
"name": "Evert Pot",
"email": "me@evertpot.com",
"homepage": "http://evertpot.com/",
"role": "Developer"
}
],
"support": {
"forum": "https://groups.google.com/group/sabredav-discuss",
"source": "https://github.com/fruux/sabre-uri"
},
"autoload": {
"files" : [
"lib/functions.php"
],
"psr-4" : {
"Sabre\\Uri\\" : "lib/"
}
},
"require-dev": {
"sabre/cs": "~0.0.1",
"phpunit/phpunit" : "*"
},
"config" : {
"bin-dir" : "bin/"
}
}

View File

@@ -3,14 +3,9 @@ php:
- 5.5
- 5.6
- 7
- hhvm
sudo: false
matrix:
allow_failures:
- php: hhvm
script:
- phpunit --configuration tests/phpunit.xml
- ./bin/sabre-cs-fixer fix . --dry-run --diff

View File

@@ -1,6 +1,19 @@
ChangeLog
=========
4.1.1 (2016-07-15)
------------------
* #327: Throwing `InvalidDataException` in more cases where invalid iCalendar
dates and times were provided. (@rsto)
* #331: Fix dealing with multiple overridden instances falling on the same
date/time (@afedyk-sugarcrm).
* #333: Fix endless loop on invalid `BYMONTH` values in recurrence.
(@PHPGangsta)
* #339: Fixed a few `validate()` results when repair is off. (@PHPGangsta)
* #338: Stripping invalid `BYMONTH=` rules during `validate()` (@PHPGangsta)
* #336: Fix incorrect `BYSECOND=` validation. (@PHPGangsta)
4.1.0 (2016-04-06)
------------------
@@ -130,6 +143,20 @@ ChangeLog
and `IntegerValue` to allow PHP 7 compatibility.
3.5.3 (????-??-??)
------------------
* #331: Fix dealing with multiple overridden instances falling on the same
date/time (@afedyk-sugarcrm).
3.5.2 (2016-04-24)
-----------------
* #312: Backported a fix related to iTip processing of events with timezones,
without a master event.
3.5.1 (2016-04-06)
------------------

0
vendor/sabre/vobject/bin/bench.php vendored Normal file → Executable file
View File

0
vendor/sabre/vobject/bin/fetch_windows_zones.php vendored Normal file → Executable file
View File

2
vendor/sabre/vobject/bin/generateicalendardata.php vendored Normal file → Executable file
View File

@@ -29,7 +29,7 @@ include __DIR__ . '/../vendor/autoload.php';
fwrite(STDERR, "Generating " . $events . " events\n");
$currentDate = new DateTime('-' . round($events / 2) . ' days');
$currentDate = new DateTime('-' . round($events / 2) . ' days');
$calendar = new VObject\Component\VCalendar();

2
vendor/sabre/vobject/bin/mergeduplicates.php vendored Normal file → Executable file
View File

@@ -157,7 +157,7 @@ while ($vcard = $splitter->getNext()) {
// echo $newProp->serialize() . " does not appear in earlier vcard!\n";
$stats['Error']++;
if ($debug) fwrite($debug, "Missing '" . $newProp->name . "' property in duplicate. Earlier vcard:\n" . $collectedNames[$fn]->serialize() . "\n\nLater:\n" . $vcard->serialize() . "\n\n");
if ($debug) fwrite($debug, "Missing '" . $newProp->name . "' property in duplicate. Earlier vcard:\n" . $collectedNames[$fn]->serialize() . "\n\nLater:\n" . $vcard->serialize() . "\n\n");
$vcard->destroy();
continue 2;

88
vendor/sabre/vobject/composer.json vendored Normal file
View File

@@ -0,0 +1,88 @@
{
"name": "sabre/vobject",
"description" : "The VObject library for PHP allows you to easily parse and manipulate iCalendar and vCard objects",
"keywords" : [
"iCalendar",
"iCal",
"vCalendar",
"vCard",
"jCard",
"jCal",
"ics",
"vcf",
"xCard",
"xCal",
"freebusy",
"recurrence",
"availability",
"rfc2425",
"rfc2426",
"rfc2739",
"rfc4770",
"rfc5545",
"rfc5546",
"rfc6321",
"rfc6350",
"rfc6351",
"rfc6474",
"rfc6638",
"rfc6715",
"rfc6868"
],
"homepage" : "http://sabre.io/vobject/",
"license" : "BSD-3-Clause",
"require" : {
"php" : ">=5.5",
"ext-mbstring" : "*",
"sabre/xml" : "~1.1"
},
"require-dev" : {
"phpunit/phpunit" : "*",
"sabre/cs" : "~0.0.3"
},
"suggest" : {
"hoa/bench" : "If you would like to run the benchmark scripts"
},
"authors" : [
{
"name" : "Evert Pot",
"email" : "me@evertpot.com",
"homepage" : "http://evertpot.com/",
"role" : "Developer"
},
{
"name" : "Dominik Tobschall",
"email" : "dominik@fruux.com",
"homepage" : "http://tobschall.de/",
"role" : "Developer"
},
{
"name" : "Ivan Enderlin",
"email" : "ivan.enderlin@hoa-project.net",
"homepage" : "http://mnt.io/",
"role" : "Developer"
}
],
"support" : {
"forum" : "https://groups.google.com/group/sabredav-discuss",
"source" : "https://github.com/fruux/sabre-vobject"
},
"autoload" : {
"psr-4" : {
"Sabre\\VObject\\" : "lib/"
}
},
"bin" : [
"bin/vobject",
"bin/generate_vcards"
],
"extra" : {
"branch-alias" : {
"dev-master" : "4.0.x-dev"
}
},
"config" : {
"bin-dir" : "bin"
}
}

View File

@@ -53,8 +53,7 @@ class VTimeZone extends VObject\Component {
'LAST-MODIFIED' => '?',
'TZURL' => '?',
// At least 1 STANDARD or DAYLIGHT must appear, or more. But both
// cannot appear in the same VTIMEZONE.
// At least 1 STANDARD or DAYLIGHT must appear.
//
// The validator is not specific yet to pick this up, so these
// rules are too loose.

View File

@@ -43,7 +43,12 @@ class DateTimeParser {
if ($matches[7] === 'Z' || is_null($tz)) {
$tz = new DateTimeZone('UTC');
}
$date = new DateTimeImmutable($matches[1] . '-' . $matches[2] . '-' . $matches[3] . ' ' . $matches[4] . ':' . $matches[5] . ':' . $matches[6], $tz);
try {
$date = new DateTimeImmutable($matches[1] . '-' . $matches[2] . '-' . $matches[3] . ' ' . $matches[4] . ':' . $matches[5] . ':' . $matches[6], $tz);
} catch (\Exception $e) {
throw new InvalidDataException('The supplied iCalendar datetime value is incorrect: ' . $dt);
}
return $date;
@@ -70,7 +75,11 @@ class DateTimeParser {
$tz = new DateTimeZone('UTC');
}
$date = new DateTimeImmutable($matches[1] . '-' . $matches[2] . '-' . $matches[3], $tz);
try {
$date = new DateTimeImmutable($matches[1] . '-' . $matches[2] . '-' . $matches[3], $tz);
} catch (\Exception $e) {
throw new InvalidDataException('The supplied iCalendar date value is incorrect: ' . $date);
}
return $date;

View File

@@ -579,7 +579,7 @@ abstract class Property extends Node {
// Checking if the propertyname does not contain any invalid bytes.
if (!preg_match('/^([A-Z0-9-]+)$/', $this->name)) {
$warnings[] = [
'level' => 1,
'level' => $options & self::REPAIR ? 1 : 3,
'message' => 'The propertyname: ' . $this->name . ' contains invalid characters. Only A-Z, 0-9 and - are allowed',
'node' => $this,
];
@@ -599,7 +599,7 @@ abstract class Property extends Node {
if ($this->root->getDocumentType() === Document::VCARD40) {
$warnings[] = [
'level' => 1,
'level' => 3,
'message' => 'ENCODING parameter is not valid in vCard 4.',
'node' => $this
];
@@ -623,7 +623,7 @@ abstract class Property extends Node {
}
if ($allowedEncoding && !in_array(strtoupper($encoding), $allowedEncoding)) {
$warnings[] = [
'level' => 1,
'level' => 3,
'message' => 'ENCODING=' . strtoupper($encoding) . ' is not valid for this document type.',
'node' => $this
];

View File

@@ -260,21 +260,39 @@ class Recur extends Property {
foreach ($values as $key => $value) {
if (empty($value)) {
if ($value === '') {
$warnings[] = [
'level' => $repair ? 3 : 1,
'level' => $repair ? 1 : 3,
'message' => 'Invalid value for ' . $key . ' in ' . $this->name,
'node' => $this
];
if ($repair) {
unset($values[$key]);
}
} elseif ($key == 'BYMONTH') {
$byMonth = (array)$value;
foreach ($byMonth as $i => $v) {
if (!is_numeric($v) || (int)$v < 1 || (int)$v > 12) {
$warnings[] = [
'level' => $repair ? 1 : 3,
'message' => 'BYMONTH in RRULE must have value(s) between 1 and 12!',
'node' => $this
];
if ($repair) {
if (is_array($value)) {
unset($values[$key][$i]);
} else {
unset($values[$key]);
}
}
}
}
}
}
if (!isset($values['FREQ'])) {
$warnings[] = [
'level' => $repair ? 3 : 1,
'level' => $repair ? 1 : 3,
'message' => 'FREQ is required in ' . $this->name,
'node' => $this
];

View File

@@ -397,7 +397,7 @@ class Text extends Property {
if (count($parts) < $minimum) {
$warnings[] = [
'level' => $options & self::REPAIR ? 1 : 3,
'message' => 'The ' . $this->name . ' property must have at least ' . $minimum . ' values. It only has ' . count($parts),
'message' => 'The ' . $this->name . ' property must have at least ' . $minimum . ' values. It only has ' . count($parts),
'node' => $this,
];
if ($options & self::REPAIR) {

View File

@@ -325,7 +325,7 @@ class EventIterator implements \Iterator {
$index = [];
foreach ($this->overriddenEvents as $key => $event) {
$stamp = $event->DTSTART->getDateTime($this->timeZone)->getTimeStamp();
$index[$stamp] = $key;
$index[$stamp][] = $key;
}
krsort($index);
$this->counter = 0;
@@ -372,8 +372,9 @@ class EventIterator implements \Iterator {
// overridden event may cut ahead.
if ($this->overriddenEventsIndex) {
$offset = end($this->overriddenEventsIndex);
$offsets = end($this->overriddenEventsIndex);
$timestamp = key($this->overriddenEventsIndex);
$offset = end($offsets);
if (!$nextDate || $timestamp < $nextDate->getTimeStamp()) {
// Overridden event comes first.
$this->currentOverriddenEvent = $this->overriddenEvents[$offset];
@@ -383,7 +384,10 @@ class EventIterator implements \Iterator {
$this->currentDate = $this->currentOverriddenEvent->DTSTART->getDateTime($this->timeZone);
// Ensuring that this item will only be used once.
array_pop($this->overriddenEventsIndex);
array_pop($this->overriddenEventsIndex[$timestamp]);
if (!$this->overriddenEventsIndex[$timestamp]) {
array_pop($this->overriddenEventsIndex);
}
// Exit point!
return;
@@ -451,7 +455,7 @@ class EventIterator implements \Iterator {
/**
* Overridden event index.
*
* Key is timestamp, value is the index of the item in the $overriddenEvent
* Key is timestamp, value is the list of indexes of the item in the $overriddenEvent
* property.
*
* @var array

View File

@@ -718,6 +718,11 @@ class RRuleIterator implements Iterator {
case 'BYMONTH' :
$this->byMonth = (array)$value;
foreach ($this->byMonth as $byMonth) {
if (!is_numeric($byMonth) || (int)$byMonth < 1 || (int)$byMonth > 12) {
throw new InvalidDataException('BYMONTH in RRULE must have value(s) betweeen 1 and 12!');
}
}
break;
case 'BYSETPOS' :

View File

@@ -240,10 +240,10 @@ class TimeZoneUtil {
if (!is_null(self::$map)) return;
self::$map = array_merge(
include __DIR__ . '/timezonedata/windowszones.php',
include __DIR__ . '/timezonedata/lotuszones.php',
include __DIR__ . '/timezonedata/exchangezones.php',
include __DIR__ . '/timezonedata/php-workaround.php'
include __DIR__ . '/timezonedata/windowszones.php',
include __DIR__ . '/timezonedata/lotuszones.php',
include __DIR__ . '/timezonedata/exchangezones.php',
include __DIR__ . '/timezonedata/php-workaround.php'
);
}
@@ -260,7 +260,7 @@ class TimeZoneUtil {
* @return array
*/
static function getIdentifiersBC() {
return include __DIR__ . '/timezonedata/php-bc.php';
return include __DIR__ . '/timezonedata/php-bc.php';
}
}

View File

@@ -14,6 +14,6 @@ class Version {
/**
* Full version number.
*/
const VERSION = '4.1.0';
const VERSION = '4.1.1';
}

View File

@@ -1,11 +1,9 @@
language: php
php:
- 5.4
- 5.5
- 5.6
- 7
- nightly
- hhvm
- 7.0
- 7.1
matrix:
fast_finish: true
@@ -16,10 +14,13 @@ cache:
directories:
- $HOME/.composer/cache
before_install:
- phpenv config-rm xdebug.ini; true
install:
- composer install
script:
- ./bin/phpunit --configuration tests/phpunit.xml.dist
- ./bin/sabre-cs-fixer fix . --dry-run --diff
before_script:
- phpenv config-rm xdebug.ini; true
- composer install

View File

@@ -1,7 +1,16 @@
ChangeLog
=========
1.4.2 (????-??-??)
1.5.0 (2016-10-09)
------------------
* Now requires PHP 5.5.
* Using `finally` to always roll back the context stack when serializing.
* #94: Fixed an infinite loop condition when reading some invalid XML
documents.
1.4.2 (2016-05-19)
------------------
* The `contextStack` in the Reader object is now correctly rolled back in

53
vendor/sabre/xml/composer.json vendored Normal file
View File

@@ -0,0 +1,53 @@
{
"name": "sabre/xml",
"description" : "sabre/xml is an XML library that you may not hate.",
"keywords" : [ "XML", "XMLReader", "XMLWriter", "DOM" ],
"homepage" : "https://sabre.io/xml/",
"license" : "BSD-3-Clause",
"require" : {
"php" : ">=5.5.5",
"ext-xmlwriter" : "*",
"ext-xmlreader" : "*",
"ext-dom" : "*",
"lib-libxml" : ">=2.6.20",
"sabre/uri" : ">=1.0,<3.0.0"
},
"authors" : [
{
"name" : "Evert Pot",
"email" : "me@evertpot.com",
"homepage" : "http://evertpot.com/",
"role" : "Developer"
},
{
"name": "Markus Staab",
"email": "markus.staab@redaxo.de",
"role" : "Developer"
}
],
"support" : {
"forum" : "https://groups.google.com/group/sabredav-discuss",
"source" : "https://github.com/fruux/sabre-xml"
},
"autoload" : {
"psr-4" : {
"Sabre\\Xml\\" : "lib/"
},
"files": [
"lib/Deserializer/functions.php",
"lib/Serializer/functions.php"
]
},
"autoload-dev" : {
"psr-4" : {
"Sabre\\Xml\\" : "tests/Sabre/Xml/"
}
},
"require-dev": {
"sabre/cs": "~1.0.0",
"phpunit/phpunit" : "*"
},
"config" : {
"bin-dir" : "bin/"
}
}

View File

@@ -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,

View File

@@ -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 {
$errors = libxml_get_errors();
libxml_clear_errors();
libxml_use_internal_errors($previousSetting);
libxml_disable_entity_loader($previousEntityState);
// 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();
if ($errors) {
throw new LibXMLException($errors);
$errors = libxml_get_errors();
libxml_clear_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()) {
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) {
throw new LibXMLException($errors);
}
throw new ParseException('This should never happen (famous last words)');
}
while (true) {
if (!$this->isValid()) {
$errors = libxml_get_errors();
if ($errors) {
libxml_clear_errors();
throw new LibXMLException($errors);
}
}
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();
}
return false;
}
while (true) {
if (!$this->isValid()) {
$errors = libxml_get_errors();
if ($errors) {
libxml_clear_errors();
if (!is_null($elementMap)) {
$this->popContext();
}
throw new LibXMLException($errors);
}
}
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();
}
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;
}
}
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)) {

View File

@@ -14,6 +14,6 @@ class Version {
/**
* Full version number
*/
const VERSION = '1.4.1';
const VERSION = '1.5.0';
}

View File

@@ -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
);