-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Describe the bug
After login the backend is not accessible due to an 501 Error with the error message:
NumberFormatter::__construct(): Argument #1 ($locale) "default" is invalid
To Reproduce
This Happens under TYPO3 v12 with version 4.5.2 when a User with "old" uc
data logs in. In the blob "uc" in table be_users the user configuration is stored in a serialized form, this includes the backend language in field "lang".
In the past the default-Option "English" has been stored as 'lang' => 'default'
, it seems this has been changed to 'lang' => 0
In wv_deepltranslate/Classes/Service/UsageService.php (version 4.5.2: line 80) this value is passed to NumberFormatter, which is unable to deal with a value of "default"
.
If NumberFormatter hasn't changed in the meantime this code is - unchanged - also present in the current git version (release 5.1.1?):
The problem arose when switching to PHP8.4 but we had an older version of wv_deepltranslate installed, that wasn't happy with php 8.4 either so THIS issue became visible AFTER updateing to PHP 8.4 and THEN updating to wv_deepltranslate 4.5.2 (From TER)
if ($this->getBackendUser() !== null) {
$uc = $this->getBackendUser()->uc;
if (is_array($uc) && array_key_exists('lang', $uc)) {
$language = $uc['lang'];
}
}
$numberFormatter = new \NumberFormatter($language, \NumberFormatter::DECIMAL);
Expected behavior
Some kind of error handling or fallback if 'lang' => 'default#
is set
Screenshots
I will add screenshots, when I figure out how
TYPO3 Setup
- TYPO3 Version: 12.4 (but probably 13+ as well, as long users still ave "old" uc data
- Server (Apache-cgi/Apache-fpm/nginx-fm/other): apache-fpm 2.4.65
- Database type and version (SQLite/Postgres/MariaDB/MySQL) MariaDB 11
- PHP version 8.4.11
- DeepL free or paid API? free
- composer or classic setup? classic (yes I know...)
Additional context
The Problem goes way, when uc data is cleared and "new" defaults are used