diff --git a/CHANGELOG.md b/CHANGELOG.md index ec536aca..6088ef09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Release Notes for Campaign -## 2.9.2 - Unreleased +## 2.9.2 - 2023-10-26 ### Fixed diff --git a/src/helpers/SendoutHelper.php b/src/helpers/SendoutHelper.php index bbc4a6a8..63a83080 100644 --- a/src/helpers/SendoutHelper.php +++ b/src/helpers/SendoutHelper.php @@ -19,13 +19,14 @@ class SendoutHelper public static function memoryInBytes(string $value): int { $unit = strtolower(substr($value, -1, 1)); + $unitValue = match ($unit) { + 'g' => pow(1024, 3), + 'm' => pow(1024, 2), + 'k' => 1024, + default => 1, + }; - return (int)$value * match ($unit) { - 'g' => pow(1024, 3), - 'm' => pow(1024, 2), - 'k' => 1024, - default => 1, - }; + return (int)$value * $unitValue; } /** @@ -34,14 +35,14 @@ public static function memoryInBytes(string $value): int * * @since 2.9.2 */ - public static function encodeEmojis(string $value): string + public static function encodeEmojis(?string $value): string { if (!Craft::$app->getDb()->getIsMysql()) { return $value; } if (empty($value)) { - return $value; + return ''; } return LitEmoji::unicodeToShortcode($value); @@ -53,14 +54,14 @@ public static function encodeEmojis(string $value): string * * @since 2.9.2 */ - public static function decodeEmojis(string $value): string + public static function decodeEmojis(?string $value): string { if (!Craft::$app->getDb()->getIsMysql()) { return $value; } if (empty($value)) { - return $value; + return ''; } return LitEmoji::shortcodeToUnicode($value);