1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-06 05:07:36 +02:00

Merge pull request #1406 from mpdude/fix-tr-locale

Fix a bug when using string-based loglevels in the `tr_TR` locale
This commit is contained in:
Jordi Boggiano
2019-12-07 13:16:30 +01:00
committed by GitHub

View File

@@ -527,8 +527,13 @@ class Logger implements LoggerInterface, ResettableInterface
*/
public static function toMonologLevel($level)
{
if (is_string($level) && defined(__CLASS__.'::'.strtoupper($level))) {
return constant(__CLASS__.'::'.strtoupper($level));
if (is_string($level)) {
// Contains chars of all log levels and avoids using strtoupper() which may have
// strange results depending on locale (for example, "i" will become "İ")
$upper = strtr($level, 'abcdefgilmnortuwy', 'ABCDEFGILMNORTUWY');
if (defined(__CLASS__.'::'.$upper)) {
return constant(__CLASS__ . '::' . $upper);
}
}
return $level;