Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-11-18 18:40:14 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-11-18 18:40:14 +0300
commit7dac7d7a85fe5e14b227d7afe7742c7bec6bbcc0 (patch)
tree24b477282dfa9140ccd407509b22de0d4c26b968 /lib/Address.php
parent7b85638b9db6cf90466921a941f7911cf4a8d27a (diff)
Catch when iconv returns false
This happens when iconv doesn't work as expected, e.g. on Alpine. Instead of causing a type error on the return value we can show a more useful exception. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/Address.php')
-rw-r--r--lib/Address.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Address.php b/lib/Address.php
index a8ea774cd..cfa96169a 100644
--- a/lib/Address.php
+++ b/lib/Address.php
@@ -79,7 +79,11 @@ class Address implements JsonSerializable {
return null;
}
// Lets make sure the e-mail is valid UTF-8 at all times
- return iconv("UTF-8","UTF-8//IGNORE", $email);
+ $utf8 = iconv("UTF-8", "UTF-8//IGNORE", $email);
+ if ($utf8 === false) {
+ throw new \Exception("Email address <$email> could not be converted via iconv");
+ }
+ return $utf8;
}
/**