mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 20:50:21 +01:00
MDL-76412 lib: Fixed PHP 8.2 utf8_encode deprecations in horde
This commit is contained in:
parent
dc51096889
commit
87f235e0bb
@ -115,13 +115,15 @@ class Horde_String
|
||||
!Horde_Util::extensionExists('iconv') ||
|
||||
!Horde_Util::extensionExists('mbstring'))) {
|
||||
if (($to == 'utf-8') &&
|
||||
function_exists('utf8_encode') &&
|
||||
in_array($from, array('iso-8859-1', 'us-ascii', 'utf-8'))) {
|
||||
return utf8_encode($input);
|
||||
return @utf8_encode($input);
|
||||
}
|
||||
|
||||
if (($from == 'utf-8') &&
|
||||
function_exists('utf8_decode') &&
|
||||
in_array($to, array('iso-8859-1', 'us-ascii', 'utf-8'))) {
|
||||
return utf8_decode($input);
|
||||
return @utf8_decode($input);
|
||||
}
|
||||
}
|
||||
|
||||
@ -381,7 +383,12 @@ class Horde_String
|
||||
$charset = self::lower($charset);
|
||||
|
||||
if ($charset == 'utf-8' || $charset == 'utf8') {
|
||||
return strlen(utf8_decode($string));
|
||||
if (Horde_Util::extensionExists('mbstring')) {
|
||||
return strlen(mb_convert_encoding($string, 'ISO-8859-1', 'UTF-8'));
|
||||
|
||||
} else if (function_exists('utf8_decode')) {
|
||||
return strlen(@utf8_decode($string));
|
||||
}
|
||||
}
|
||||
|
||||
if (Horde_Util::extensionExists('mbstring')) {
|
||||
|
@ -40,3 +40,11 @@ do
|
||||
cp -Rf $locale/* $target/locale
|
||||
fi
|
||||
done
|
||||
|
||||
Local modifications:
|
||||
- lib/Horde/Imap/Client/Exception/ServerResponse.php has been minimally modified for php80 compatibility
|
||||
The fix applied is already upstream, see https://github.com/horde/Imap_Client/pull/13 and it's available
|
||||
in Imap_Client 2.30.4 and up. See MDL-73405 for more details.
|
||||
|
||||
Notes:
|
||||
* 2023-01-30 Applied patch https://github.com/horde/Util/pull/11. See MDL-76412 for more details.
|
||||
|
Loading…
x
Reference in New Issue
Block a user