diff options
author | Mario <mario@mariovavti.com> | 2022-10-11 18:18:57 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-10-11 18:18:57 +0000 |
commit | 5e5f0aa955d86743a14531bed98501b59140ab1f (patch) | |
tree | f8a7bbff876adf28d03cc005b8e0a0602886ffc8 /vendor/sabre/vobject/lib | |
parent | f9a4c53e3feb07e5319b110b25b4746ae839c420 (diff) | |
download | volse-hubzilla-5e5f0aa955d86743a14531bed98501b59140ab1f.tar.gz volse-hubzilla-5e5f0aa955d86743a14531bed98501b59140ab1f.tar.bz2 volse-hubzilla-5e5f0aa955d86743a14531bed98501b59140ab1f.zip |
update composer libs
Diffstat (limited to 'vendor/sabre/vobject/lib')
-rw-r--r-- | vendor/sabre/vobject/lib/Cli.php | 2 | ||||
-rw-r--r-- | vendor/sabre/vobject/lib/Component.php | 12 | ||||
-rw-r--r-- | vendor/sabre/vobject/lib/Component/VCard.php | 5 | ||||
-rw-r--r-- | vendor/sabre/vobject/lib/Parameter.php | 3 | ||||
-rw-r--r-- | vendor/sabre/vobject/lib/Parser/MimeDir.php | 20 | ||||
-rw-r--r-- | vendor/sabre/vobject/lib/Property.php | 2 | ||||
-rw-r--r-- | vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php | 6 | ||||
-rw-r--r-- | vendor/sabre/vobject/lib/Property/Text.php | 22 | ||||
-rw-r--r-- | vendor/sabre/vobject/lib/Recur/RRuleIterator.php | 30 | ||||
-rw-r--r-- | vendor/sabre/vobject/lib/StringUtil.php | 18 | ||||
-rw-r--r-- | vendor/sabre/vobject/lib/VCardConverter.php | 5 | ||||
-rw-r--r-- | vendor/sabre/vobject/lib/Version.php | 2 |
12 files changed, 83 insertions, 44 deletions
diff --git a/vendor/sabre/vobject/lib/Cli.php b/vendor/sabre/vobject/lib/Cli.php index 816e2cb31..3bde16f9c 100644 --- a/vendor/sabre/vobject/lib/Cli.php +++ b/vendor/sabre/vobject/lib/Cli.php @@ -456,7 +456,7 @@ HELP */ protected function color($vObj) { - fwrite($this->stdout, $this->serializeComponent($vObj)); + $this->serializeComponent($vObj); } /** diff --git a/vendor/sabre/vobject/lib/Component.php b/vendor/sabre/vobject/lib/Component.php index f33b628a7..a929387a3 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 + * @var array<string, Component|Property> */ 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 $name such as VCALENDAR, VEVENT - * @param bool $defaults + * @param string|null $name such as VCALENDAR, VEVENT + * @param bool $defaults */ public function __construct(Document $root, $name, array $children = [], $defaults = true) { - $this->name = strtoupper($name); + $this->name = isset($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 && strtoupper($child->group) === $group; + return $child instanceof Property && (null !== $child->group ? 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 && strtoupper($child->group) === $group) { + if ($child instanceof Property && (null !== $child->group ? 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 eac789842..90a6df72f 100644 --- a/vendor/sabre/vobject/lib/Component/VCard.php +++ b/vendor/sabre/vobject/lib/Component/VCard.php @@ -291,6 +291,11 @@ 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 7e4d55743..c27b2aa47 100644 --- a/vendor/sabre/vobject/lib/Parameter.php +++ b/vendor/sabre/vobject/lib/Parameter.php @@ -52,11 +52,12 @@ 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 db0f81531..513f7bd0c 100644 --- a/vendor/sabre/vobject/lib/Parser/MimeDir.php +++ b/vendor/sabre/vobject/lib/Parser/MimeDir.php @@ -167,7 +167,11 @@ class MimeDir extends Parser while (true) { // Reading until we hit END: - $line = $this->readLine(); + try { + $line = $this->readLine(); + } catch (EofException $oEx) { + $line = 'END:'.$this->root->name; + } if ('END:' === strtoupper(substr($line, 0, 4))) { break; } @@ -372,12 +376,22 @@ 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], @@ -450,10 +464,8 @@ class MimeDir extends Parser switch (strtolower($charset)) { case 'utf-8': break; - case 'iso-8859-1': - $property['value'] = utf8_encode($property['value']); - break; case 'windows-1252': + case 'iso-8859-1': $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 50cda9684..56096dafe 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 + * @var string|null */ public $group; diff --git a/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php b/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php index 2dbbc6eaf..c90967d79 100644 --- a/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php +++ b/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php @@ -53,7 +53,11 @@ class CalAddress extends Text return $input; } list($schema, $everythingElse) = explode(':', $input, 2); + $schema = strtolower($schema); + if ('mailto' === $schema) { + $everythingElse = strtolower($everythingElse); + } - return strtolower($schema).':'.$everythingElse; + return $schema.':'.$everythingElse; } } diff --git a/vendor/sabre/vobject/lib/Property/Text.php b/vendor/sabre/vobject/lib/Property/Text.php index ac8aa066b..16d2c07f4 100644 --- a/vendor/sabre/vobject/lib/Property/Text.php +++ b/vendor/sabre/vobject/lib/Property/Text.php @@ -136,16 +136,18 @@ class Text extends Property } foreach ($item as &$subItem) { - $subItem = strtr( - $subItem, - [ - '\\' => '\\\\', - ';' => '\;', - ',' => '\,', - "\n" => '\n', - "\r" => '', - ] - ); + if (!is_null($subItem)) { + $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 d556aa6c3..4f0e9070d 100644 --- a/vendor/sabre/vobject/lib/Recur/RRuleIterator.php +++ b/vendor/sabre/vobject/lib/Recur/RRuleIterator.php @@ -25,6 +25,13 @@ 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 @@ -366,6 +373,12 @@ 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)) || @@ -486,7 +499,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() > 253402300799) { + if ($this->currentDate->getTimestamp() > self::dateUpperLimit) { $this->currentDate = null; return; @@ -589,11 +602,12 @@ 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->add(new \DateInterval('P'.$byYearDay.'D')); + $date = $date->setDate($currentYear, 1, 1); + $date = $date->add(new \DateInterval('P'.($byYearDay - 1).'D')); } else { - $date = $date->sub(new \DateInterval('P'.abs($byYearDay).'D')); + $date = $date->setDate($currentYear, 12, 31); + $date = $date->sub(new \DateInterval('P'.abs($byYearDay + 1).'D')); } if ($date > $this->currentDate && in_array($date->format('N'), $dayOffsets)) { @@ -658,6 +672,14 @@ 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 2333d6ab9..b04539e4a 100644 --- a/vendor/sabre/vobject/lib/StringUtil.php +++ b/vendor/sabre/vobject/lib/StringUtil.php @@ -40,23 +40,11 @@ class StringUtil */ public static function convertToUTF8($str) { - $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; + if (!mb_check_encoding($str, 'UTF-8') && mb_check_encoding($str, 'ISO-8859-1')) { + $str = mb_convert_encoding($str, 'UTF-8', 'ISO-8859-1'); } // Removing any control characters - return preg_replace('%(?:[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F])%', '', $newStr); + return preg_replace('%(?:[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F])%', '', $str); } } diff --git a/vendor/sabre/vobject/lib/VCardConverter.php b/vendor/sabre/vobject/lib/VCardConverter.php index 04932fe67..04129e355 100644 --- a/vendor/sabre/vobject/lib/VCardConverter.php +++ b/vendor/sabre/vobject/lib/VCardConverter.php @@ -140,6 +140,8 @@ 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 @@ -173,6 +175,9 @@ 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 64938bf0b..92882f2f1 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.4.1'; + const VERSION = '4.5.1'; } |