Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2905450
D25249.1737346207.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
D25249.1737346207.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D25249: Fix PHP 8.0 ValueError calling mb_convert_encoding() with an invalid encoding
Attached
Detach File
Event Timeline
Log In to Comment