From fed2af3d131fc3ecc3911d09e588aa7b11d2ccf1 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Wed, 5 Mar 2025 18:48:34 +0900 Subject: [PATCH] Fix fatal error in CLI scripts in PHP 8.4 #2513 --- common/framework/URL.php | 7 ++++++- modules/module/module.model.php | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/common/framework/URL.php b/common/framework/URL.php index e4dadae3f..6752eb99d 100644 --- a/common/framework/URL.php +++ b/common/framework/URL.php @@ -258,7 +258,12 @@ class URL $position = 0; } - if (function_exists('idn_to_utf8')) + $domain = (string)$domain; + if ($domain === '') + { + $new_domain = ''; + } + elseif (function_exists('idn_to_utf8')) { $new_domain = idn_to_utf8($domain); } diff --git a/modules/module/module.model.php b/modules/module/module.model.php index 79c1c2f7d..4530f252b 100644 --- a/modules/module/module.model.php +++ b/modules/module/module.model.php @@ -195,13 +195,13 @@ class ModuleModel extends Module /** * @brief Get the default mid according to the domain */ - public static function getDefaultMid($domain = null) + public static function getDefaultMid($domain = '') { // Get current domain. $domain = $domain ? Rhymix\Framework\URL::decodeIdna($domain) : Rhymix\Framework\URL::getCurrentDomain(); // Find the domain information. - $domain_info = self::getSiteInfoByDomain($domain); + $domain_info = $domain ? self::getSiteInfoByDomain($domain) : null; if (!$domain_info) { $domain_info = self::getDefaultDomainInfo();