Hi,
i have an error after Upgrade from 3.20.5 to 3.20.10.
Error Message:
Look into class.gettext.php - Line 406:
I don't know this syntax in PHP but if i comment out the line everything works without error.
What's the problem here?
Edit: complete function:
i have an error after Upgrade from 3.20.5 to 3.20.10.
Error Message:
Aw, snap! Internal Server Error [debug @ print] - https://chv.to/v3debug
** errorId #8b930baa8b80feb8 **
At /lib/G/classes/class.gettext.php:406ParseError [0]: syntax error, unexpected '='
Stack trace:
#0 unknown file(unknown line): class_autoloader('G\Gettext')
#1 /app/lib/classes/class.l10n.php(193): spl_autoload_call('G\Gettext')
#2 /app/lib/classes/class.l10n.php(121): CHV\L10n:rocessTranslation('de')
#3 /app/lib/classes/class.l10n.php(132): CHV\L10n->__construct()
#4 /app/lib/classes/class.l10n.php(232): CHV\L10n::getInstance()
#5 /app/lib/classes/class.l10n.php(252): CHV\L10n::getStatic('gettext')
#6 /app/lib/classes/class.l10n.php(220): CHV\L10n::getGettext()
#7 /app/lib/l10n.php(43): CHV\L10n::ngettext('image', 'images', '183')
#8 /app/lib/classes/class.user.php(520): _n('image', 'images', '183')
#9 /app/lib/classes/class.user.php(486): CHV\User::fill(Array)
#10 /app/lib/classes/class.user.php(58): CHV\User::formatArray(Array)
#11 /app/lib/classes/class.login.php(153): CHV\User::getSingle('1', 'id')
#12 /app/lib/classes/class.login.php(129): CHV\Login::login('1', 'cookie')
#13 /app/lib/classes/class.login.php(109): CHV\Login::loginCookie('KEEP_LOGIN')
#14 /app/lib/classes/class.login.php(77): CHV\Login::tryCookies()
#15 /app/web.php(63): CHV\Login::tryLogin()
#16 /lib/G/classes/class.handler.php(125): CHV\{closure}(G\Handler)
#17 /app/web.php(407): G\Handler->__construct(Array)
#18 /app/loader.php(230): require_once('/app/web.php')
#19 /index.php(20): include_once('/app/loader.php')
Look into class.gettext.php - Line 406:
$msgstr ??= null;
I don't know this syntax in PHP but if i comment out the line everything works without error.
What's the problem here?
Edit: complete function:
PHP:
private function parsePOEntry($chunk)
{
$chunks = explode("\n", $chunk);
foreach ($chunks as $chunk) {
if (starts_with('#', $chunk) or is_null($chunk)) {
continue;
}
if (is_null($this->translation_plural) and starts_with('"Plural-Forms:', $chunk)) {
$this->parsePluralData($chunk);
}
if (preg_match('/^msgid "(.*)"/', $chunk, $matches)) {
$msgid = $matches[1];
} elseif (preg_match('/^msgstr "(.*)"/', $chunk, $matches)) {
$msgstr = $matches[1];
} elseif (preg_match('/^#~ msgid "(.*)"/', $chunk, $matches)) {
$msgid = $matches[1];
} elseif (preg_match('/^#~ msgstr "(.*)"/', $chunk, $matches)) {
$msgstr = $matches[1];
} elseif (preg_match('/^msgstr\[([0-9])+\] "(.*)"/', $chunk, $matches)) {
if ($matches[2] == '') {
continue;
}
if (!is_array($msgstr ?? null)) {
$msgstr = [];
}
$msgstr[$matches[1]] = $matches[2];
}
}
//$msgstr ??= null;
if ($msgstr == '') {
$msgstr = null;
}
if (empty($msgid)) {
return null;
} else {
return [
'msgid' => $msgid,
'msgstr'=> is_null($msgstr) ? null : (array)$msgstr
];
}
}