aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/vobject/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/vobject/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/vobject/lib')
-rw-r--r--vendor/sabre/vobject/lib/Component/VTimeZone.php3
-rw-r--r--vendor/sabre/vobject/lib/DateTimeParser.php13
-rw-r--r--vendor/sabre/vobject/lib/Property.php6
-rw-r--r--vendor/sabre/vobject/lib/Property/ICalendar/Recur.php24
-rw-r--r--vendor/sabre/vobject/lib/Property/Text.php2
-rw-r--r--vendor/sabre/vobject/lib/Recur/EventIterator.php12
-rw-r--r--vendor/sabre/vobject/lib/Recur/RRuleIterator.php5
-rw-r--r--vendor/sabre/vobject/lib/TimeZoneUtil.php10
-rw-r--r--vendor/sabre/vobject/lib/Version.php2
9 files changed, 56 insertions, 21 deletions
diff --git a/vendor/sabre/vobject/lib/Component/VTimeZone.php b/vendor/sabre/vobject/lib/Component/VTimeZone.php
index d5d886947..f6eb6cba1 100644
--- a/vendor/sabre/vobject/lib/Component/VTimeZone.php
+++ b/vendor/sabre/vobject/lib/Component/VTimeZone.php
@@ -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.
diff --git a/vendor/sabre/vobject/lib/DateTimeParser.php b/vendor/sabre/vobject/lib/DateTimeParser.php
index fc568abb0..443bbb660 100644
--- a/vendor/sabre/vobject/lib/DateTimeParser.php
+++ b/vendor/sabre/vobject/lib/DateTimeParser.php
@@ -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;
diff --git a/vendor/sabre/vobject/lib/Property.php b/vendor/sabre/vobject/lib/Property.php
index 112775131..1aaa3ed58 100644
--- a/vendor/sabre/vobject/lib/Property.php
+++ b/vendor/sabre/vobject/lib/Property.php
@@ -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
];
diff --git a/vendor/sabre/vobject/lib/Property/ICalendar/Recur.php b/vendor/sabre/vobject/lib/Property/ICalendar/Recur.php
index a3c36dc64..8392a5cc1 100644
--- a/vendor/sabre/vobject/lib/Property/ICalendar/Recur.php
+++ b/vendor/sabre/vobject/lib/Property/ICalendar/Recur.php
@@ -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
];
diff --git a/vendor/sabre/vobject/lib/Property/Text.php b/vendor/sabre/vobject/lib/Property/Text.php
index 2e16ac534..abc17563f 100644
--- a/vendor/sabre/vobject/lib/Property/Text.php
+++ b/vendor/sabre/vobject/lib/Property/Text.php
@@ -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) {
diff --git a/vendor/sabre/vobject/lib/Recur/EventIterator.php b/vendor/sabre/vobject/lib/Recur/EventIterator.php
index 86c996aec..f91c336bc 100644
--- a/vendor/sabre/vobject/lib/Recur/EventIterator.php
+++ b/vendor/sabre/vobject/lib/Recur/EventIterator.php
@@ -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
diff --git a/vendor/sabre/vobject/lib/Recur/RRuleIterator.php b/vendor/sabre/vobject/lib/Recur/RRuleIterator.php
index 402e2de83..4c89f3ce4 100644
--- a/vendor/sabre/vobject/lib/Recur/RRuleIterator.php
+++ b/vendor/sabre/vobject/lib/Recur/RRuleIterator.php
@@ -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' :
diff --git a/vendor/sabre/vobject/lib/TimeZoneUtil.php b/vendor/sabre/vobject/lib/TimeZoneUtil.php
index 4873daf92..2a95ae898 100644
--- a/vendor/sabre/vobject/lib/TimeZoneUtil.php
+++ b/vendor/sabre/vobject/lib/TimeZoneUtil.php
@@ -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';
}
}
diff --git a/vendor/sabre/vobject/lib/Version.php b/vendor/sabre/vobject/lib/Version.php
index 0b0e16c03..ca9f21960 100644
--- a/vendor/sabre/vobject/lib/Version.php
+++ b/vendor/sabre/vobject/lib/Version.php
@@ -14,6 +14,6 @@ class Version {
/**
* Full version number.
*/
- const VERSION = '4.1.0';
+ const VERSION = '4.1.1';
}