aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/vobject
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/vobject')
-rw-r--r--vendor/sabre/vobject/.github/workflows/ci.yml63
-rw-r--r--vendor/sabre/vobject/lib/Cli.php2
-rw-r--r--vendor/sabre/vobject/lib/Component.php12
-rw-r--r--vendor/sabre/vobject/lib/Component/VCard.php5
-rw-r--r--vendor/sabre/vobject/lib/Parameter.php3
-rw-r--r--vendor/sabre/vobject/lib/Parser/MimeDir.php20
-rw-r--r--vendor/sabre/vobject/lib/Property.php2
-rw-r--r--vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php6
-rw-r--r--vendor/sabre/vobject/lib/Property/Text.php22
-rw-r--r--vendor/sabre/vobject/lib/Recur/RRuleIterator.php30
-rw-r--r--vendor/sabre/vobject/lib/StringUtil.php18
-rw-r--r--vendor/sabre/vobject/lib/VCardConverter.php5
-rw-r--r--vendor/sabre/vobject/lib/Version.php2
13 files changed, 107 insertions, 83 deletions
diff --git a/vendor/sabre/vobject/.github/workflows/ci.yml b/vendor/sabre/vobject/.github/workflows/ci.yml
new file mode 100644
index 000000000..3a019fe77
--- /dev/null
+++ b/vendor/sabre/vobject/.github/workflows/ci.yml
@@ -0,0 +1,63 @@
+name: continuous-integration
+on:
+ push:
+ branches:
+ - master
+ - release/*
+ pull_request:
+jobs:
+ unit-testing:
+ name: PHPUnit (PHP ${{ matrix.php-versions }})
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1']
+ coverage: ['pcov']
+ code-analysis: ['no']
+ include:
+ - php-versions: '7.1'
+ coverage: 'none'
+ code-analysis: 'yes'
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Setup PHP, with composer and extensions
+ uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
+ with:
+ php-version: ${{ matrix.php-versions }}
+ extensions: mbstring, dom, fileinfo, mysql, redis, opcache
+ coverage: ${{ matrix.coverage }}
+ tools: composer
+
+ - name: Get composer cache directory
+ id: composer-cache
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Cache composer dependencies
+ uses: actions/cache@v2
+ with:
+ path: ${{ steps.composer-cache.outputs.dir }}
+ # Use composer.json for key, if composer.lock is not committed.
+ # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
+ restore-keys: ${{ runner.os }}-composer-
+
+ - name: Install composer dependencies
+ run: composer install --no-progress --prefer-dist --optimize-autoloader
+
+ - name: Code Analysis (PHP CS-Fixer)
+ if: matrix.code-analysis == 'yes'
+ run: php vendor/bin/php-cs-fixer fix --dry-run --diff
+
+ - name: Code Analysis (PHPStan)
+ if: matrix.code-analysis == 'yes'
+ run: composer phpstan
+
+ - name: Test with phpunit
+ run: vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml
+
+ - name: Code Coverage
+ uses: codecov/codecov-action@v2
+ if: matrix.coverage != 'none'
diff --git a/vendor/sabre/vobject/lib/Cli.php b/vendor/sabre/vobject/lib/Cli.php
index 3bde16f9c..816e2cb31 100644
--- a/vendor/sabre/vobject/lib/Cli.php
+++ b/vendor/sabre/vobject/lib/Cli.php
@@ -456,7 +456,7 @@ HELP
*/
protected function color($vObj)
{
- $this->serializeComponent($vObj);
+ fwrite($this->stdout, $this->serializeComponent($vObj));
}
/**
diff --git a/vendor/sabre/vobject/lib/Component.php b/vendor/sabre/vobject/lib/Component.php
index a929387a3..f33b628a7 100644
--- a/vendor/sabre/vobject/lib/Component.php
+++ b/vendor/sabre/vobject/lib/Component.php
@@ -28,7 +28,7 @@ class Component extends Node
/**
* A list of properties and/or sub-components.
*
- * @var array<string, Component|Property>
+ * @var array
*/
protected $children = [];
@@ -43,12 +43,12 @@ class Component extends Node
* an iCalendar object, this may be something like CALSCALE:GREGORIAN. To
* ensure that this does not happen, set $defaults to false.
*
- * @param string|null $name such as VCALENDAR, VEVENT
- * @param bool $defaults
+ * @param string $name such as VCALENDAR, VEVENT
+ * @param bool $defaults
*/
public function __construct(Document $root, $name, array $children = [], $defaults = true)
{
- $this->name = isset($name) ? strtoupper($name) : '';
+ $this->name = strtoupper($name);
$this->root = $root;
if ($defaults) {
@@ -238,7 +238,7 @@ class Component extends Node
return array_filter(
$result,
function ($child) use ($group) {
- return $child instanceof Property && (null !== $child->group ? strtoupper($child->group) : '') === $group;
+ return $child instanceof Property && strtoupper($child->group) === $group;
}
);
}
@@ -249,7 +249,7 @@ class Component extends Node
$result = [];
foreach ($this->children as $childGroup) {
foreach ($childGroup as $child) {
- if ($child instanceof Property && (null !== $child->group ? strtoupper($child->group) : '') === $group) {
+ if ($child instanceof Property && strtoupper($child->group) === $group) {
$result[] = $child;
}
}
diff --git a/vendor/sabre/vobject/lib/Component/VCard.php b/vendor/sabre/vobject/lib/Component/VCard.php
index 90a6df72f..eac789842 100644
--- a/vendor/sabre/vobject/lib/Component/VCard.php
+++ b/vendor/sabre/vobject/lib/Component/VCard.php
@@ -291,11 +291,6 @@ class VCard extends VObject\Document
$this->FN = (string) $this->ORG;
$repaired = true;
- // Otherwise, the NICKNAME property may work
- } elseif (isset($this->NICKNAME)) {
- $this->FN = (string) $this->NICKNAME;
- $repaired = true;
-
// Otherwise, the EMAIL property may work
} elseif (isset($this->EMAIL)) {
$this->FN = (string) $this->EMAIL;
diff --git a/vendor/sabre/vobject/lib/Parameter.php b/vendor/sabre/vobject/lib/Parameter.php
index c27b2aa47..7e4d55743 100644
--- a/vendor/sabre/vobject/lib/Parameter.php
+++ b/vendor/sabre/vobject/lib/Parameter.php
@@ -52,12 +52,11 @@ class Parameter extends Node
*/
public function __construct(Document $root, $name, $value = null)
{
+ $this->name = strtoupper($name);
$this->root = $root;
if (is_null($name)) {
$this->noName = true;
$this->name = static::guessParameterNameByValue($value);
- } else {
- $this->name = strtoupper($name);
}
// If guessParameterNameByValue() returns an empty string
diff --git a/vendor/sabre/vobject/lib/Parser/MimeDir.php b/vendor/sabre/vobject/lib/Parser/MimeDir.php
index 513f7bd0c..db0f81531 100644
--- a/vendor/sabre/vobject/lib/Parser/MimeDir.php
+++ b/vendor/sabre/vobject/lib/Parser/MimeDir.php
@@ -167,11 +167,7 @@ class MimeDir extends Parser
while (true) {
// Reading until we hit END:
- try {
- $line = $this->readLine();
- } catch (EofException $oEx) {
- $line = 'END:'.$this->root->name;
- }
+ $line = $this->readLine();
if ('END:' === strtoupper(substr($line, 0, 4))) {
break;
}
@@ -376,22 +372,12 @@ class MimeDir extends Parser
$value = $this->unescapeParam($value);
if (is_null($lastParam)) {
- if ($this->options & self::OPTION_IGNORE_INVALID_LINES) {
- // When the property can't be matched and the configuration
- // option is set to ignore invalid lines, we ignore this line
- // This can happen when servers provide faulty data as iCloud
- // frequently does with X-APPLE-STRUCTURED-LOCATION
- continue;
- }
throw new ParseException('Invalid Mimedir file. Line starting at '.$this->startLine.' did not follow iCalendar/vCard conventions');
}
if (is_null($property['parameters'][$lastParam])) {
$property['parameters'][$lastParam] = $value;
} elseif (is_array($property['parameters'][$lastParam])) {
$property['parameters'][$lastParam][] = $value;
- } elseif ($property['parameters'][$lastParam] === $value) {
- // When the current value of the parameter is the same as the
- // new one, then we can leave the current parameter as it is.
} else {
$property['parameters'][$lastParam] = [
$property['parameters'][$lastParam],
@@ -464,8 +450,10 @@ class MimeDir extends Parser
switch (strtolower($charset)) {
case 'utf-8':
break;
- case 'windows-1252':
case 'iso-8859-1':
+ $property['value'] = utf8_encode($property['value']);
+ break;
+ case 'windows-1252':
$property['value'] = mb_convert_encoding($property['value'], 'UTF-8', $charset);
break;
default:
diff --git a/vendor/sabre/vobject/lib/Property.php b/vendor/sabre/vobject/lib/Property.php
index 56096dafe..50cda9684 100644
--- a/vendor/sabre/vobject/lib/Property.php
+++ b/vendor/sabre/vobject/lib/Property.php
@@ -30,7 +30,7 @@ abstract class Property extends Node
*
* This is only used in vcards
*
- * @var string|null
+ * @var string
*/
public $group;
diff --git a/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php b/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php
index c90967d79..2dbbc6eaf 100644
--- a/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php
+++ b/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php
@@ -53,11 +53,7 @@ class CalAddress extends Text
return $input;
}
list($schema, $everythingElse) = explode(':', $input, 2);
- $schema = strtolower($schema);
- if ('mailto' === $schema) {
- $everythingElse = strtolower($everythingElse);
- }
- return $schema.':'.$everythingElse;
+ return strtolower($schema).':'.$everythingElse;
}
}
diff --git a/vendor/sabre/vobject/lib/Property/Text.php b/vendor/sabre/vobject/lib/Property/Text.php
index 16d2c07f4..ac8aa066b 100644
--- a/vendor/sabre/vobject/lib/Property/Text.php
+++ b/vendor/sabre/vobject/lib/Property/Text.php
@@ -136,18 +136,16 @@ class Text extends Property
}
foreach ($item as &$subItem) {
- if (!is_null($subItem)) {
- $subItem = strtr(
- $subItem,
- [
- '\\' => '\\\\',
- ';' => '\;',
- ',' => '\,',
- "\n" => '\n',
- "\r" => '',
- ]
- );
- }
+ $subItem = strtr(
+ $subItem,
+ [
+ '\\' => '\\\\',
+ ';' => '\;',
+ ',' => '\,',
+ "\n" => '\n',
+ "\r" => '',
+ ]
+ );
}
$item = implode(',', $item);
}
diff --git a/vendor/sabre/vobject/lib/Recur/RRuleIterator.php b/vendor/sabre/vobject/lib/Recur/RRuleIterator.php
index 4f0e9070d..d556aa6c3 100644
--- a/vendor/sabre/vobject/lib/Recur/RRuleIterator.php
+++ b/vendor/sabre/vobject/lib/Recur/RRuleIterator.php
@@ -25,13 +25,6 @@ use Sabre\VObject\Property;
class RRuleIterator implements Iterator
{
/**
- * Constant denoting the upper limit on how long into the future
- * we want to iterate. The value is a unix timestamp and currently
- * corresponds to the datetime 9999-12-31 11:59:59 UTC.
- */
- const dateUpperLimit = 253402300799;
-
- /**
* Creates the Iterator.
*
* @param string|array $rrule
@@ -373,12 +366,6 @@ class RRuleIterator implements Iterator
// Current hour of the day
$currentHour = $this->currentDate->format('G');
-
- if ($this->currentDate->getTimestamp() > self::dateUpperLimit) {
- $this->currentDate = null;
-
- return;
- }
} while (
($this->byDay && !in_array($currentDay, $recurrenceDays)) ||
($this->byHour && !in_array($currentHour, $recurrenceHours)) ||
@@ -499,7 +486,7 @@ class RRuleIterator implements Iterator
// To prevent running this forever (better: until we hit the max date of DateTimeImmutable) we simply
// stop at 9999-12-31. Looks like the year 10000 problem is not solved in php ....
- if ($this->currentDate->getTimestamp() > self::dateUpperLimit) {
+ if ($this->currentDate->getTimestamp() > 253402300799) {
$this->currentDate = null;
return;
@@ -602,12 +589,11 @@ class RRuleIterator implements Iterator
// loop through all YearDay and Days to check all the combinations
foreach ($this->byYearDay as $byYearDay) {
$date = clone $this->currentDate;
+ $date = $date->setDate($currentYear, 1, 1);
if ($byYearDay > 0) {
- $date = $date->setDate($currentYear, 1, 1);
- $date = $date->add(new \DateInterval('P'.($byYearDay - 1).'D'));
+ $date = $date->add(new \DateInterval('P'.$byYearDay.'D'));
} else {
- $date = $date->setDate($currentYear, 12, 31);
- $date = $date->sub(new \DateInterval('P'.abs($byYearDay + 1).'D'));
+ $date = $date->sub(new \DateInterval('P'.abs($byYearDay).'D'));
}
if ($date > $this->currentDate && in_array($date->format('N'), $dayOffsets)) {
@@ -672,14 +658,6 @@ class RRuleIterator implements Iterator
(int) $currentMonth,
(int) $currentDayOfMonth
);
-
- // To prevent running this forever (better: until we hit the max date of DateTimeImmutable) we simply
- // stop at 9999-12-31. Looks like the year 10000 problem is not solved in php ....
- if ($this->currentDate->getTimestamp() > self::dateUpperLimit) {
- $this->currentDate = null;
-
- return;
- }
}
// If we made it here, it means we got a valid occurrence
diff --git a/vendor/sabre/vobject/lib/StringUtil.php b/vendor/sabre/vobject/lib/StringUtil.php
index b04539e4a..2333d6ab9 100644
--- a/vendor/sabre/vobject/lib/StringUtil.php
+++ b/vendor/sabre/vobject/lib/StringUtil.php
@@ -40,11 +40,23 @@ class StringUtil
*/
public static function convertToUTF8($str)
{
- if (!mb_check_encoding($str, 'UTF-8') && mb_check_encoding($str, 'ISO-8859-1')) {
- $str = mb_convert_encoding($str, 'UTF-8', 'ISO-8859-1');
+ $encoding = mb_detect_encoding($str, ['UTF-8', 'ISO-8859-1', 'WINDOWS-1252'], true);
+
+ switch ($encoding) {
+ case 'ISO-8859-1':
+ $newStr = utf8_encode($str);
+ break;
+ /* Unreachable code. Not sure yet how we can improve this
+ * situation.
+ case 'WINDOWS-1252' :
+ $newStr = iconv('cp1252', 'UTF-8', $str);
+ break;
+ */
+ default:
+ $newStr = $str;
}
// Removing any control characters
- return preg_replace('%(?:[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F])%', '', $str);
+ return preg_replace('%(?:[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F])%', '', $newStr);
}
}
diff --git a/vendor/sabre/vobject/lib/VCardConverter.php b/vendor/sabre/vobject/lib/VCardConverter.php
index 04129e355..04932fe67 100644
--- a/vendor/sabre/vobject/lib/VCardConverter.php
+++ b/vendor/sabre/vobject/lib/VCardConverter.php
@@ -140,8 +140,6 @@ class VCardConverter
$newProperty = $output->createProperty('X-ADDRESSBOOKSERVER-KIND', 'GROUP');
break;
}
- } elseif ('MEMBER' === $property->name) {
- $newProperty = $output->createProperty('X-ADDRESSBOOKSERVER-MEMBER', $property->getValue());
}
} elseif (Document::VCARD40 === $targetVersion) {
// These properties were removed in vCard 4.0
@@ -175,9 +173,6 @@ class VCardConverter
$newProperty = $output->createProperty('KIND', 'GROUP');
}
break;
- case 'X-ADDRESSBOOKSERVER-MEMBER':
- $newProperty = $output->createProperty('MEMBER', $property->getValue());
- break;
case 'X-ANNIVERSARY':
$newProperty->name = 'ANNIVERSARY';
// If we already have an anniversary property with the same
diff --git a/vendor/sabre/vobject/lib/Version.php b/vendor/sabre/vobject/lib/Version.php
index 92882f2f1..64938bf0b 100644
--- a/vendor/sabre/vobject/lib/Version.php
+++ b/vendor/sabre/vobject/lib/Version.php
@@ -14,5 +14,5 @@ class Version
/**
* Full version number.
*/
- const VERSION = '4.5.1';
+ const VERSION = '4.4.1';
}