From 91876b42aa5bc15ccdf7d6dfd2974126ff767b61 Mon Sep 17 00:00:00 2001 From: "Mr. Chip" <36813506+mrchipset@users.noreply.github.com> Date: Mon, 23 Sep 2024 10:49:47 +0800 Subject: [PATCH] Fix: fix preg_match parameter#2 $subject is null deprecated issue (#1798) --- var/Typecho/I18n/GetText.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/var/Typecho/I18n/GetText.php b/var/Typecho/I18n/GetText.php index 677a80ed..8e91afd4 100644 --- a/var/Typecho/I18n/GetText.php +++ b/var/Typecho/I18n/GetText.php @@ -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;";