Fix: fix preg_match parameter#2 $subject is null deprecated issue (#1798)

This commit is contained in:
Mr. Chip 2024-09-23 10:49:47 +08:00 committed by GitHub
parent 5783cb0d01
commit 91876b42aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -394,7 +394,8 @@ class GetText
} else {
$header = $this->getTranslationString(0);
}
if (preg_match("/plural\-forms: ([^\n]*)\n/i", $header, $regs)) {
if (!is_null($header) && preg_match("/plural\-forms: ([^\n]*)\n/i", $header, $regs)) {
$expr = $regs[1];
} else {
$expr = "nplurals=2; plural=n == 1 ? 0 : 1;";