Panel not working on new server (LC_CTYPE)

Heya

I’ve had this error show up on my local machine before, but thought it was because of things not being rightly configured so I moved on.
Now moving the (working) site to a different server, I again see that error when I try to log in.
The frontend is working fine and all the language and language switching works as expected.
But as soon as I want to login into the panel, I get this error (after submiting my login data)

Argument 1 passed to Kirby\Toolkit\Str::before() 
must be of the type string, null given, called in 
/home/axanader/www/example.com/
docs/kirby/src/Cms/Language.php on line 421

the language files are basic:

# /site/languages/en.php
return [
  'code' => 'en',
  'direction' => 'ltr',
  'locale' => 'en_US',
  'name' => 'English',
];

I tried adding more local data, but this had no effect:

return [
  'code' => 'en',
  'direction' => 'ltr',
  'locale'	=> [
  	'en_US',
  	LC_ALL			=> 'en_US.utf8',
  	LC_COLLATE	=> 'en_US.utf8',
  	LC_MONETARY => 'en_US.utf8',
  	LC_NUMERIC	=> 'en_US.utf8',
  	LC_TIME		 	=> 'en_US.utf8',
  	LC_MESSAGES => 'en_US.utf8',
  	LC_CTYPE		=> 'en_US.utf8'
  ],
  'name' => 'English',
];

I also tried adding setlocale(LC_ALL, 'en_US.utf-8'); to the main index.php

Bash output for locale is:

LANG=
LC_CTYPE="C"
LC_COLLATE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=

which I am very much assuming I can not change, as it is a simple webhosting product.

If there is no other (kirby) option, I might ask the server admins to add this, although I hope there is another way?

Any input appreciated, thanks!

What if you add it like this:

'locale'	=> [
  	'en_US',
  ],

Have you done this for all languages?

damn! you’re always so fast in replying! awesome!

after some more testing (sorry, should have done that before, but your “all languages” hint was important)
I found, that one language was wrong:

    'locale' => [
        6 => 'it_IT'
    ],

It was setup using the panel, not via new file.
I have to check if we added this 6 or if it was done by the panel.

Changing it to

    'locale' => 'it_IT',

now lets me login to the panel

Ok. Confirming:
the 6 was added by the panel.
I tried adding a new language to the old server, and this file is created:

<?php

return [
    'code' => 'gr',
    'default' => false,
    'direction' => 'ltr',
    'locale' => [
        6 => 'el_GR'
    ],
    'name' => 'grisch',
    'translations' => [

    ],
    'url' => NULL
];

If I add a new language to the new sever, there is no 6:

<?php

return [
    'code' => 'gr',
    'default' => false,
    'direction' => 'ltr',
    'locale' => [
        'el_GR'
    ],
    'name' => 'grisch',
    'translations' => [

    ],
    'url' => NULL
];

Both are running v3.3.3

Yes, the result depends on the server.

any insight on what the 6 is used for and how this might break moving to different server?

@gork This issue known and will be fixed in the next version as 3.3.5:

1 Like