diff --git a/lib/Horde/String.php b/lib/Horde/String.php index a2e74db..d65f189 100644 --- a/lib/Horde/String.php +++ b/lib/Horde/String.php @@ -258,14 +258,12 @@ public static function lower($string, $locale = false, $charset = null) return strtolower($string); } + $string = $string ?? ''; + if (!isset(self::$_lowers[$string])) { $language = setlocale(LC_CTYPE, 0); setlocale(LC_CTYPE, 'C'); - if ($string === null) { - self::$_lowers[$string] = ''; - } else { - self::$_lowers[$string] = strtolower($string); - } + self::$_lowers[$string] = strtolower($string); setlocale(LC_CTYPE, $language); } @@ -1052,6 +1050,10 @@ public static function validUtf8($text) */ protected static function _mbstringCharset($charset) { + if ($charset === "") { + return null; + } + /* mbstring functions do not handle the 'ks_c_5601-1987' & * 'ks_c_5601-1989' charsets. However, these charsets are used, for * example, by various versions of Outlook to send Korean characters. diff --git a/src/HordeString.php b/src/HordeString.php index af227b8..225eae9 100644 --- a/src/HordeString.php +++ b/src/HordeString.php @@ -1063,6 +1063,10 @@ public static function validUtf8($text) */ protected static function _mbstringCharset($charset) { + if ($charset === "") { + return null; + } + /* mbstring functions do not handle the 'ks_c_5601-1987' & * 'ks_c_5601-1989' charsets. However, these charsets are used, for * example, by various versions of Outlook to send Korean characters.