diff --git a/Sources/Actions/Admin/Permissions.php b/Sources/Actions/Admin/Permissions.php index fc218e7a05..5c9881ef88 100644 --- a/Sources/Actions/Admin/Permissions.php +++ b/Sources/Actions/Admin/Permissions.php @@ -2470,7 +2470,7 @@ protected function setGroupsContext(): void ]; } - Group::countPermissionsBatch(array_keys(Utils::$context['groups']), (int) $_REQUEST['pid'] ?? null); + Group::countPermissionsBatch(array_keys(Utils::$context['groups']), isset($_REQUEST['pid']) ? (int) $_REQUEST['pid'] : null); } /** diff --git a/Sources/Actions/Admin/Server.php b/Sources/Actions/Admin/Server.php index bae7d5a9f1..e864c51b29 100644 --- a/Sources/Actions/Admin/Server.php +++ b/Sources/Actions/Admin/Server.php @@ -263,7 +263,7 @@ public function general(): void // Ensure all URLs are aligned with the new force_ssl setting // Treat unset like 0 - $this->alignURLsWithSSLSetting((int) $_POST['force_ssl'] ?? 0); + $this->alignURLsWithSSLSetting((int) ($_POST['force_ssl'] ?? 0)); ACP::saveSettings($config_vars); $_SESSION['adm-save'] = true; diff --git a/Sources/Actions/Unread.php b/Sources/Actions/Unread.php index 9557291c1f..e81fa9ad2f 100644 --- a/Sources/Actions/Unread.php +++ b/Sources/Actions/Unread.php @@ -874,8 +874,8 @@ protected function getTopicRequestWithoutTempTable(): void list($num_topics, $min_message) = Db::$db->fetch_row($request); Db::$db->free_result($request); - $this->num_topics = (int) $num_topics ?? 0; - $this->min_message = (int) $min_message ?? 0; + $this->num_topics = (int) ($num_topics ?? 0); + $this->min_message = (int) ($min_message ?? 0); if ($this->num_topics == 0) { $this->setNoTopics(); diff --git a/Sources/Actions/UnreadReplies.php b/Sources/Actions/UnreadReplies.php index 91ba934a8f..5820093a55 100644 --- a/Sources/Actions/UnreadReplies.php +++ b/Sources/Actions/UnreadReplies.php @@ -323,8 +323,8 @@ protected function getTopicRequestWithoutTempTable(): void list($num_topics, $min_message) = Db::$db->fetch_row($request); Db::$db->free_result($request); - $this->num_topics = (int) $num_topics ?? 0; - $this->min_message = (int) $min_message ?? 0; + $this->num_topics = (int) ($num_topics ?? 0); + $this->min_message = (int) ($min_message ?? 0); if ($this->num_topics == 0) { $this->setNoTopics(); diff --git a/Sources/Profile.php b/Sources/Profile.php index 534f63609f..4bad5caf6e 100644 --- a/Sources/Profile.php +++ b/Sources/Profile.php @@ -2800,8 +2800,8 @@ protected function setAvatarAttachment(string $filepath): ?string } // Check whether the image is too large. - $max_width = (int) Config::$modSettings['avatar_max_width_external'] ?? 0; - $max_height = (int) Config::$modSettings['avatar_max_height_external'] ?? 0; + $max_width = (int) (Config::$modSettings['avatar_max_width_external'] ?? 0); + $max_height = (int) (Config::$modSettings['avatar_max_height_external'] ?? 0); if ($image->shouldResize($max_width, $max_height)) { // Try to resize it, unless the admin disabled resizing. diff --git a/Sources/Subs-Compat.php b/Sources/Subs-Compat.php index 643cc947bf..ac17edbbed 100644 --- a/Sources/Subs-Compat.php +++ b/Sources/Subs-Compat.php @@ -3225,7 +3225,7 @@ function read_tgz_file( ): array|bool { return PackageManager\SubsPackage::read_tgz_file( $gzfilename, - (string) $destination ?? null, + isset($destination) ? (string) $destination : null, $single_file, $overwrite, $files_to_extract, diff --git a/Sources/User.php b/Sources/User.php index 8baa6d3645..4cb9fd5766 100644 --- a/Sources/User.php +++ b/Sources/User.php @@ -935,7 +935,7 @@ class User implements \ArrayAccess public function __set(string $prop, mixed $value): void { if (in_array($this->prop_aliases[$prop] ?? $prop, ['additional_groups', 'buddies', 'ignoreusers', 'ignoreboards']) && is_string($value)) { - $prop = (string) $this->prop_aliases[$prop] ?? $prop; + $prop = (string) ($this->prop_aliases[$prop] ?? $prop); $value = array_map('intval', array_filter(explode(',', $value), 'strlen')); }