diff --git a/program/lib/Roundcube/bootstrap.php b/program/lib/Roundcube/bootstrap.php index d84bfc1cc..fca751df7 100644 --- a/program/lib/Roundcube/bootstrap.php +++ b/program/lib/Roundcube/bootstrap.php @@ -326,7 +326,7 @@ function array_first($array) function asciiwords($str, $css_id = false, $replace_with = '') { $allowed = 'a-z0-9\_\-' . (!$css_id ? '\.' : ''); - return preg_replace("/[^$allowed]+/i", $replace_with, $str); + return preg_replace("/[^$allowed]+/i", $replace_with, (string) $str); } /** @@ -340,7 +340,7 @@ function asciiwords($str, $css_id = false, $replace_with = '') function is_ascii($str, $control_chars = true) { $regexp = $control_chars ? '/[^\x00-\x7F]/' : '/[^\x20-\x7E]/'; - return preg_match($regexp, $str) ? false : true; + return preg_match($regexp, (string) $str) ? false : true; } /** diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php index 0b6915f67..f87033863 100644 --- a/program/lib/Roundcube/rcube.php +++ b/program/lib/Roundcube/rcube.php @@ -833,7 +833,7 @@ class rcube $lang = $rcube_language_aliases[$lang]; } // try the first two chars - else if (!isset($rcube_languages[$lang])) { + else if ($lang && !isset($rcube_languages[$lang])) { $short = substr($lang, 0, 2); // check if we have an alias for the short language code @@ -846,7 +846,7 @@ class rcube } } - if (!isset($rcube_languages[$lang]) || !is_dir(RCUBE_LOCALIZATION_DIR . $lang)) { + if (!$lang || !isset($rcube_languages[$lang]) || !is_dir(RCUBE_LOCALIZATION_DIR . $lang)) { $lang = 'en_US'; }