From 745515b11f438d3658203aaaaf151c72e30d5e7c Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Mon, 17 Oct 2016 23:26:48 +0200 Subject: [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. --- vendor/sabre/vobject/.travis.yml | 5 -- vendor/sabre/vobject/CHANGELOG.md | 27 +++++++ vendor/sabre/vobject/bin/bench.php | 0 vendor/sabre/vobject/bin/fetch_windows_zones.php | 0 vendor/sabre/vobject/bin/generateicalendardata.php | 2 +- vendor/sabre/vobject/bin/mergeduplicates.php | 2 +- vendor/sabre/vobject/composer.json | 88 ++++++++++++++++++++++ vendor/sabre/vobject/lib/Component/VTimeZone.php | 3 +- vendor/sabre/vobject/lib/DateTimeParser.php | 13 +++- vendor/sabre/vobject/lib/Property.php | 6 +- .../sabre/vobject/lib/Property/ICalendar/Recur.php | 24 +++++- vendor/sabre/vobject/lib/Property/Text.php | 2 +- vendor/sabre/vobject/lib/Recur/EventIterator.php | 12 ++- vendor/sabre/vobject/lib/Recur/RRuleIterator.php | 5 ++ vendor/sabre/vobject/lib/TimeZoneUtil.php | 10 +-- vendor/sabre/vobject/lib/Version.php | 2 +- 16 files changed, 173 insertions(+), 28 deletions(-) mode change 100644 => 100755 vendor/sabre/vobject/bin/bench.php mode change 100644 => 100755 vendor/sabre/vobject/bin/fetch_windows_zones.php mode change 100644 => 100755 vendor/sabre/vobject/bin/generateicalendardata.php mode change 100644 => 100755 vendor/sabre/vobject/bin/mergeduplicates.php create mode 100644 vendor/sabre/vobject/composer.json (limited to 'vendor/sabre/vobject') diff --git a/vendor/sabre/vobject/.travis.yml b/vendor/sabre/vobject/.travis.yml index 06bbdf8a0..b7266a878 100644 --- a/vendor/sabre/vobject/.travis.yml +++ b/vendor/sabre/vobject/.travis.yml @@ -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 diff --git a/vendor/sabre/vobject/CHANGELOG.md b/vendor/sabre/vobject/CHANGELOG.md index 0bd7d53bd..4c72680f8 100644 --- a/vendor/sabre/vobject/CHANGELOG.md +++ b/vendor/sabre/vobject/CHANGELOG.md @@ -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) ------------------ diff --git a/vendor/sabre/vobject/bin/bench.php b/vendor/sabre/vobject/bin/bench.php old mode 100644 new mode 100755 diff --git a/vendor/sabre/vobject/bin/fetch_windows_zones.php b/vendor/sabre/vobject/bin/fetch_windows_zones.php old mode 100644 new mode 100755 diff --git a/vendor/sabre/vobject/bin/generateicalendardata.php b/vendor/sabre/vobject/bin/generateicalendardata.php old mode 100644 new mode 100755 index dfcf18780..a2df3c63a --- a/vendor/sabre/vobject/bin/generateicalendardata.php +++ b/vendor/sabre/vobject/bin/generateicalendardata.php @@ -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(); diff --git a/vendor/sabre/vobject/bin/mergeduplicates.php b/vendor/sabre/vobject/bin/mergeduplicates.php old mode 100644 new mode 100755 index 1662e7bf3..076524d36 --- a/vendor/sabre/vobject/bin/mergeduplicates.php +++ b/vendor/sabre/vobject/bin/mergeduplicates.php @@ -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; diff --git a/vendor/sabre/vobject/composer.json b/vendor/sabre/vobject/composer.json new file mode 100644 index 000000000..bd6348a82 --- /dev/null +++ b/vendor/sabre/vobject/composer.json @@ -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" + } +} 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'; } -- cgit v1.2.3