Page MenuHomePhorge

D25249.1737346207.diff
No OneTemporary

D25249.1737346207.diff

diff --git a/src/utils/utf8.php b/src/utils/utf8.php
--- a/src/utils/utf8.php
+++ b/src/utils/utf8.php
@@ -718,7 +718,27 @@
'mbstring'));
}
- $result = @mb_convert_encoding($string, $to_encoding, $from_encoding);
+ if (version_compare(PHP_VERSION, '8.2', '>=')) {
+ // Avoid unit test failure "Handling Base64 via mbstring is deprecated;
+ // use base64_encode/base64_decode instead" since PHP 8.2
+ $available_encodings = array_diff(mb_list_encodings(),
+ ['BASE64', 'UUENCODE', 'HTML-ENTITIES', 'Quoted-Printable']);
+ } else {
+ $available_encodings = mb_list_encodings();
+ }
+ foreach ($available_encodings as $enc) {
+ $available_encodings =
+ array_merge($available_encodings, mb_encoding_aliases($enc));
+ }
+ $available_encodings =
+ array_change_key_case(array_fill_keys($available_encodings, true));
+ $to_encoding_is_valid =
+ array_key_exists(strtolower($to_encoding), $available_encodings);
+ if ($to_encoding_is_valid) {
+ $result = @mb_convert_encoding($string, $to_encoding, $from_encoding);
+ } else {
+ $result = false;
+ }
if ($result === false) {
$message = error_get_last();

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 20, 04:10 (1 d, 5 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1135632
Default Alt Text
D25249.1737346207.diff (1 KB)

Event Timeline