diff --git a/src/utils/utf8.php b/src/utils/utf8.php --- a/src/utils/utf8.php +++ b/src/utils/utf8.php @@ -789,18 +789,22 @@ * @phutil-external-symbol function mb_convert_case */ function phutil_utf8_strtolower($str) { - if (function_exists('mb_convert_case')) { - return mb_convert_case($str, MB_CASE_LOWER, 'UTF-8'); - } + if (phutil_nonempty_stringlike($str)) { + if (function_exists('mb_convert_case')) { + return mb_convert_case($str, MB_CASE_LOWER, 'UTF-8'); + } - static $map; - if ($map === null) { - $map = array_combine( - range('A', 'Z'), - range('a', 'z')); - } + static $map; + if ($map === null) { + $map = array_combine( + range('A', 'Z'), + range('a', 'z')); + } - return phutil_utf8_strtr($str, $map); + return phutil_utf8_strtr($str, $map); + } else { + return ''; + } }