Skip to content

Commit

Permalink
Merge branch 'release/4.0.1' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Welch committed Aug 15, 2022
2 parents bb237a0 + aa4dabf commit d72b8c0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# iCalendar Changelog

## 4.0.1 - 2022.09.15
### Changed
* Fixed an issue with multi-byte encoded content that would cause PHP to run out of memory ([#34](https://github.com/nystudio107/craft-icalendar/issues/34))

## 4.0.0 - 2022.06.29
### Added
* Initial Craft CMS 4 release
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nystudio107/craft-icalendar",
"description": "Tools for parsing & formatting the RFC 2445 iCalendar (.ics) specification",
"type": "craft-plugin",
"version": "4.0.0",
"version": "4.0.1",
"keywords": [
"craft",
"cms",
Expand Down
7 changes: 3 additions & 4 deletions src/services/Convert.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
namespace nystudio107\icalendar\services;

use craft\base\Component;
use function strlen;

/**
* @author nystudio107
Expand Down Expand Up @@ -76,14 +75,14 @@ protected function icalSplit(string $preamble, string $value): string
$value = html_entity_decode($value);
$value = preg_replace('/\n+/', ' ', $value);
$value = preg_replace('/\s{2,}/', ' ', $value);
$preamble_len = strlen($preamble);
$preamble_len = mb_strlen($preamble);
$lines = [];
while (strlen($value) > (self::MAX_OCTETS - $preamble_len)) {
while (mb_strlen($value) > (self::MAX_OCTETS - $preamble_len)) {
$space = (self::MAX_OCTETS - $preamble_len);
$mbcc = $space;
while ($mbcc) {
$line = mb_substr($value, 0, $mbcc);
$oct = strlen($line);
$oct = mb_strlen($line);
if ($oct > $space) {
$mbcc -= $oct - $space;
} else {
Expand Down

0 comments on commit d72b8c0

Please sign in to comment.