diff --git a/Sources/Actions/Admin/ACP.php b/Sources/Actions/Admin/ACP.php index ffed6f03ac..d987b0d610 100644 --- a/Sources/Actions/Admin/ACP.php +++ b/Sources/Actions/Admin/ACP.php @@ -1913,7 +1913,7 @@ function (&$value, $key) { $value = strtr($value, [ '{scripturl}' => Config::$scripturl, '{boardurl}' => Config::$boardurl, - ]); + ]); } }, ); diff --git a/Sources/Actions/Admin/Bans.php b/Sources/Actions/Admin/Bans.php index 1b8dc2805b..048c1952a3 100644 --- a/Sources/Actions/Admin/Bans.php +++ b/Sources/Actions/Admin/Bans.php @@ -2405,7 +2405,7 @@ protected function getMemberData(int $id): array * If null, the triggers will be deleted from all groups. * @return bool Whether the operation was successful. */ - protected static function removeBanTriggers(array|int $items_ids = [], int $group_id = null): bool + protected static function removeBanTriggers(array|int $items_ids = [], ?int $group_id = null): bool { if (isset($group_id)) { $group_id = (int) $group_id; diff --git a/Sources/Actions/Admin/Calendar.php b/Sources/Actions/Admin/Calendar.php index 72321e9423..d9d9cc7404 100644 --- a/Sources/Actions/Admin/Calendar.php +++ b/Sources/Actions/Admin/Calendar.php @@ -246,7 +246,7 @@ public function edit(): void ], ); } else { - $date = Time::strftime($_REQUEST['year'] <= 1004 ? '1004-%m-%d' : '%Y-%m-%d',mktime(0, 0, 0, (int) $_REQUEST['month'], (int) $_REQUEST['day'], (int) $_REQUEST['year'])); + $date = Time::strftime($_REQUEST['year'] <= 1004 ? '1004-%m-%d' : '%Y-%m-%d', mktime(0, 0, 0, (int) $_REQUEST['month'], (int) $_REQUEST['day'], (int) $_REQUEST['year'])); if (isset($_REQUEST['edit'])) { Db::$db->query( @@ -321,7 +321,7 @@ public function edit(): void } // Last day for the drop down? - Utils::$context['holiday']['last_day'] = (int) Time::strftime('%d', mktime(0, 0, 0, Utils::$context['holiday']['month'] == 12 ? 1 : (int) Utils::$context['holiday']['month'] + 1, 0, Utils::$context['holiday']['month'] == 12 ? (int)Utils::$context['holiday']['year'] + 1 : (int) Utils::$context['holiday']['year'])); + Utils::$context['holiday']['last_day'] = (int) Time::strftime('%d', mktime(0, 0, 0, Utils::$context['holiday']['month'] == 12 ? 1 : (int) Utils::$context['holiday']['month'] + 1, 0, Utils::$context['holiday']['month'] == 12 ? (int) Utils::$context['holiday']['year'] + 1 : (int) Utils::$context['holiday']['year'])); } /** diff --git a/Sources/Actions/Admin/Registration.php b/Sources/Actions/Admin/Registration.php index 89cc923614..cf734d48fe 100644 --- a/Sources/Actions/Admin/Registration.php +++ b/Sources/Actions/Admin/Registration.php @@ -329,7 +329,7 @@ public function privacyPolicy(): void ]; if (isset(Config::$modSettings['policy_updated_' . Utils::$context['current_policy_lang']], Config::$modSettings['policy_' . Utils::$context['current_policy_lang'] . '_' . Config::$modSettings['policy_updated_' . Utils::$context['current_policy_lang']]])) { - $policy_settings['policy_' . Utils::$context['current_policy_lang'] . '_' . Config::$modSettings['policy_updated_' . Utils::$context['current_policy_lang']]] = Utils::$context['privacy_policy']; + $policy_settings['policy_' . Utils::$context['current_policy_lang'] . '_' . Config::$modSettings['policy_updated_' . Utils::$context['current_policy_lang']]] = Utils::$context['privacy_policy']; } $policy_settings['policy_updated_' . Utils::$context['current_policy_lang']] = time(); diff --git a/Sources/Actions/Admin/RepairBoards.php b/Sources/Actions/Admin/RepairBoards.php index e37d26dad8..3b0b39e01a 100644 --- a/Sources/Actions/Admin/RepairBoards.php +++ b/Sources/Actions/Admin/RepairBoards.php @@ -1312,7 +1312,7 @@ protected function createSalvageArea(): void /** * Callback to fix missing topics. - * + * * @param array $row Message with missing topic. */ protected function fixMissingTopics(array $row): void @@ -1384,7 +1384,7 @@ protected function fixMissingTopics(array $row): void /** * Callback to remove all topics that have zero messages in the messages table. - * + * * @param array $topics An array of topic ids. */ protected function fixMissingMessages(array $topics): void @@ -1410,7 +1410,7 @@ protected function fixMissingMessages(array $topics): void /** * Callback to fix missing poll options. - * + * * @param array $row Message with missing topic. */ protected function fixMissingPollOptions(array $row): void @@ -1537,7 +1537,7 @@ protected function fixMissingPollOptions(array $row): void /** * Callback to fix polls that have no topic. - * + * * @param array $row Message with missing topic. */ protected function fixMissingPollTopics(array $row): void @@ -1627,7 +1627,7 @@ protected function fixMissingPollTopics(array $row): void /** * Callback to fix missing first and last message IDs for a topic. - * + * * @param array $row Topic data. */ protected function fixTopicStats(array $row): bool @@ -1667,7 +1667,7 @@ protected function fixTopicStats(array $row): bool /** * Callback to get a message about missing first and last message IDs for a * topic. - * + * * @param array $row Topic data. */ protected function topicStatsMessage(array $row): bool @@ -1694,7 +1694,7 @@ protected function topicStatsMessage(array $row): bool /** * Callback to fix the recorded number of replies to a topic. - * + * * @param array $row Topic data. */ protected function fixTopicStats2(array $row): bool @@ -1723,7 +1723,7 @@ protected function fixTopicStats2(array $row): bool /** * Callback to get a message about an incorrect record of the number of * replies to a topic. - * + * * @param array $row Topic data. */ protected function topicStatsMessage2(array $row): bool @@ -1742,7 +1742,7 @@ protected function topicStatsMessage2(array $row): bool /** * Callback to fix the recorded number of unapproved replies to a topic. - * + * * @param array $row Topic data. */ protected function fixTopicStats3(array $row): void @@ -1763,7 +1763,7 @@ protected function fixTopicStats3(array $row): void /** * Callback to give a home to topics that have no board. - * + * * @param array $row Topic data. */ protected function fixMissingBoards(array $row): void @@ -1806,7 +1806,7 @@ protected function fixMissingBoards(array $row): void /** * Callback to give a home to boards that have no category. - * + * * @param array $cats An array of missing Categories. */ protected function fixMissingCategories(array $cats): void @@ -1827,7 +1827,7 @@ protected function fixMissingCategories(array $cats): void /** * Callback to give an author to messages that don't have one. - * + * * @param array $msgs An array of messages. */ protected function fixMissingPosters(array $msgs): void @@ -1846,7 +1846,7 @@ protected function fixMissingPosters(array $msgs): void /** * Callback to let our salvage board adopt orphaned child boards. - * + * * @param array $parents An array of board ids. */ protected function fixMissingParents(array $parents): void @@ -1869,7 +1869,7 @@ protected function fixMissingParents(array $parents): void /** * Callback to remove non-existent polls from topics. - * + * * @param array $polls An array of poll ids. */ protected function fixMissingPolls(array $polls): void @@ -1887,7 +1887,7 @@ protected function fixMissingPolls(array $polls): void /** * Callback to remove broken links to topics from calendar events. - * + * * @param array $events An array of topic ids. */ protected function fixMissingCaledarTopics(array $events): void @@ -1905,7 +1905,7 @@ protected function fixMissingCaledarTopics(array $events): void /** * Callback to remove log_topics entries for non-existent topics. - * + * * @param array $topics An array of topic ids. */ protected function fixMissingLogTopics(array $topics): void @@ -1922,7 +1922,7 @@ protected function fixMissingLogTopics(array $topics): void /** * Callback to remove log_topics entries for non-existent members. - * + * * @param array $members An array of member ids. */ protected function fixMissingLogTopicsMembers(array $members): void @@ -1939,7 +1939,7 @@ protected function fixMissingLogTopicsMembers(array $members): void /** * Callback to remove log_boards entries for non-existent boards. - * + * * @param array $boards An array of board ids. */ protected function fixMissingLogBoards(array $boards): void @@ -1956,7 +1956,7 @@ protected function fixMissingLogBoards(array $boards): void /** * Callback to remove log_boards entries for non-existent members. - * + * * @param array $members An array of member ids. */ protected function fixMissingLogBoardsMembers(array $members): void @@ -1973,7 +1973,7 @@ protected function fixMissingLogBoardsMembers(array $members): void /** * Callback to remove log_mark_read entries for non-existent boards. - * + * * @param array $boards An array of board ids. */ protected function fixMissingLogMarkRead(array $boards): void @@ -1990,7 +1990,7 @@ protected function fixMissingLogMarkRead(array $boards): void /** * Callback to remove log_mark_read entries for non-existent members. - * + * * @param array $members An array of member ids. */ protected function fixMissingLogMarkReadMembers(array $members): void @@ -2008,7 +2008,7 @@ protected function fixMissingLogMarkReadMembers(array $members): void /** * Callback to remove non-existent personal messages from the recipients' * inboxes. - * + * * @param array $pms An array of personal message ids. */ protected function fixMissingPMs(array $pms): void @@ -2025,7 +2025,7 @@ protected function fixMissingPMs(array $pms): void /** * Callback to remove non-existent recipients from personal messages. - * + * * @param array $members An array of member ids. */ protected function fixMissingRecipients(array $members): void @@ -2043,7 +2043,7 @@ protected function fixMissingRecipients(array $members): void /** * Callback to fix the assigned authorship of PMs from non-existent senders. * Specifically, such PMs will be shown to have been sent from a guest. - * + * * @param array $guestMessages An array of personal messages ids. */ protected function fixMissingSenders(array $guestMessages): void @@ -2061,7 +2061,7 @@ protected function fixMissingSenders(array $guestMessages): void /** * Callback to remove log_notify entries for non-existent members. - * + * * @param array $members An array of member ids. */ protected function fixMissingNotifyMembers(array $members): void @@ -2078,7 +2078,7 @@ protected function fixMissingNotifyMembers(array $members): void /** * Callback to fix missing log_search_subjects entries for a topic. - * + * * @param array $result Search result id */ protected function fixMissingCachedSubject(array $result): void @@ -2117,7 +2117,7 @@ protected function fixMissingCachedSubject(array $result): void /** * Callback to get a message about missing log_search_subjects entries for a * topic. - * + * * @param array $row Search result id */ protected function missingCachedSubjectMessage(array $row): bool @@ -2133,7 +2133,7 @@ protected function missingCachedSubjectMessage(array $row): bool /** * Callback to remove log_search_subjects entries for non-existent topics. - * + * * @param array $deleteTopics An array of topic ids. */ protected function fixMissingTopicForCache(array $deleteTopics): void @@ -2150,7 +2150,7 @@ protected function fixMissingTopicForCache(array $deleteTopics): void /** * Callback to remove poll votes made by non-existent members. - * + * * @param array $members An array of member ids. */ protected function fixMissingMemberVote(array $members): void @@ -2167,7 +2167,7 @@ protected function fixMissingMemberVote(array $members): void /** * Callback to remove poll votes made in non-existent polls. - * + * * @param array $polls An array of poll ids. */ protected function fixMissingLogPollVote(array $polls): void @@ -2184,7 +2184,7 @@ protected function fixMissingLogPollVote(array $polls): void /** * Callback to remove non-existent comments from reports. - * + * * @param array $reports An array of report ids. */ protected function fixReportMissingComments(array $reports): void @@ -2201,7 +2201,7 @@ protected function fixReportMissingComments(array $reports): void /** * Callback to remove comments made on non-existent reports. - * + * * @param array $reports An array of report ids. */ protected function fixCommentMissingReport(array $reports): void @@ -2218,7 +2218,7 @@ protected function fixCommentMissingReport(array $reports): void /** * Callback to remove requests to join a group made by non-existent members. - * + * * @param array $members An array of member ids. */ protected function fixGroupRequestMissingMember(array $members): void @@ -2235,7 +2235,7 @@ protected function fixGroupRequestMissingMember(array $members): void /** * Callback to remove requests to join non-existent groups. - * + * * @param array $groups An array of group ids. */ protected function fixGroupRequestMissingGroup(array $groups): void diff --git a/Sources/Actions/Admin/Server.php b/Sources/Actions/Admin/Server.php index d6dbe21948..bae7d5a9f1 100644 --- a/Sources/Actions/Admin/Server.php +++ b/Sources/Actions/Admin/Server.php @@ -155,7 +155,7 @@ class Server implements ActionInterface */ public static bool $diskspace_disabled = false; - + /**************************** * Internal static properties ****************************/ diff --git a/Sources/Actions/Admin/Subscriptions.php b/Sources/Actions/Admin/Subscriptions.php index bf9967bf47..530b004e70 100644 --- a/Sources/Actions/Admin/Subscriptions.php +++ b/Sources/Actions/Admin/Subscriptions.php @@ -899,7 +899,7 @@ public function modifyUser(): void 0, (int) $_POST['month'], (int) $_POST['day'], - (int) $_POST['year'] + (int) $_POST['year'], ); $endtime = mktime( @@ -908,7 +908,7 @@ public function modifyUser(): void 0, (int) $_POST['monthend'], (int) $_POST['dayend'], - (int) $_POST['yearend'] + (int) $_POST['yearend'], ); // Status. diff --git a/Sources/Actions/Admin/Themes.php b/Sources/Actions/Admin/Themes.php index 8ae63e6923..bc5a2d71d3 100644 --- a/Sources/Actions/Admin/Themes.php +++ b/Sources/Actions/Admin/Themes.php @@ -985,7 +985,7 @@ public function install(): void * Shows an interface for editing the templates. * - uses the Themes template and edit_template/edit_style sub template. * - accessed via ?action=admin;area=theme;sa=edit - * + * * @return ?string 'no_themes' returned if we can't find the theme, otherwise nothing is returned. */ public function edit(): ?string @@ -2190,6 +2190,7 @@ protected function deltree(string $path): bool } reset($objects); + return rmdir($path); } diff --git a/Sources/Actions/Admin/Warnings.php b/Sources/Actions/Admin/Warnings.php index 7406a6db3a..7ab8dbd780 100644 --- a/Sources/Actions/Admin/Warnings.php +++ b/Sources/Actions/Admin/Warnings.php @@ -41,7 +41,7 @@ class Warnings implements ActionInterface * Currently enabled moderation settings. */ public static bool $currently_enabled; - + /**************************** * Internal static properties ****************************/ diff --git a/Sources/Actions/AutoSuggest.php b/Sources/Actions/AutoSuggest.php index cc93f9f9bd..37d4f7529b 100644 --- a/Sources/Actions/AutoSuggest.php +++ b/Sources/Actions/AutoSuggest.php @@ -239,7 +239,7 @@ public function versions(): array } $row = Db::$db->fetch_assoc($request); - + if (!empty($row['data'])) { // The file can have either Windows or Linux line endings, but let's // ensure we clean it as best we can. diff --git a/Sources/Actions/BoardIndex.php b/Sources/Actions/BoardIndex.php index 7818d88c46..5f9c8a5ffd 100644 --- a/Sources/Actions/BoardIndex.php +++ b/Sources/Actions/BoardIndex.php @@ -419,7 +419,7 @@ public static function get(array $board_index_options): array } // If this board has new posts in it (and isn't the recycle bin!) then the category is new. - /** @var \SMF\Category $category */ + /* @var \SMF\Category $category */ if (empty(Config::$modSettings['recycle_enable']) || Config::$modSettings['recycle_board'] != $row_board['id_board']) { $category->new = $category->new || empty($row_board['is_read']); } diff --git a/Sources/Actions/Groups.php b/Sources/Actions/Groups.php index e9f7292554..a2284b3c60 100644 --- a/Sources/Actions/Groups.php +++ b/Sources/Actions/Groups.php @@ -519,6 +519,7 @@ public function requests(): void $groups = Group::load((int) $group_id); $result = false; + /** @var \SMF\Group $group */ if ($groups != [] && ($group = $groups[$group_id]) && $group instanceof Group) { $result = $group->addMembers($members); diff --git a/Sources/Actions/Login2.php b/Sources/Actions/Login2.php index 16cd01764b..f46d151581 100644 --- a/Sources/Actions/Login2.php +++ b/Sources/Actions/Login2.php @@ -695,7 +695,7 @@ protected function phpBB3_password_check(string $passwd, string $passwd_hash): ? /** * Check activation status of the current user. - * + * * @return bool True if they are activated, false otherwise. */ protected function checkActivation(): bool diff --git a/Sources/Actions/Memberlist.php b/Sources/Actions/Memberlist.php index 2335f69947..01b08a7011 100644 --- a/Sources/Actions/Memberlist.php +++ b/Sources/Actions/Memberlist.php @@ -321,9 +321,9 @@ public function all(): void list($start) = Db::$db->fetch_row($request); $start = (int) $start; Db::$db->free_result($request); - } - else + } else { $start = (int) $_REQUEST['start']; + } Utils::$context['letter_links'] = ''; diff --git a/Sources/Actions/MessageIndex.php b/Sources/Actions/MessageIndex.php index 439a289c48..a238994851 100644 --- a/Sources/Actions/MessageIndex.php +++ b/Sources/Actions/MessageIndex.php @@ -554,6 +554,7 @@ protected function setPaginationAndLinks(): void Utils::$context['maxindex'] = isset($_REQUEST['all']) && !empty(Config::$modSettings['enableAllMessages']) ? Board::$info->total_topics : Utils::$context['topics_per_page']; $start = (int) $_REQUEST['start']; + // Make sure the starting place makes sense and construct the page index. if ($this->sort_by !== $this->sort_default || !$this->ascending_is_default) { Utils::$context['page_index'] = new PageIndex(Config::$scripturl . '?board=' . Board::$info->id . '.%1$d' . ($this->sort_default == $this->sort_by ? '' : ';sort=' . $this->sort_by) . ($this->ascending_is_default ? '' : ($this->ascending ? ';asc' : ';desc')), $start, Board::$info->total_topics, (int) Utils::$context['maxindex'], true); diff --git a/Sources/Actions/Moderation/Main.php b/Sources/Actions/Moderation/Main.php index ef25fe298d..483e2b979f 100644 --- a/Sources/Actions/Moderation/Main.php +++ b/Sources/Actions/Moderation/Main.php @@ -414,9 +414,9 @@ function (&$value, $key) { if (is_string($value)) { $value = strtr($value, [ - '{scripturl}' => Config::$scripturl, - '{boardurl}' => Config::$boardurl, - ]); + '{scripturl}' => Config::$scripturl, + '{boardurl}' => Config::$boardurl, + ]); } }, ); diff --git a/Sources/Actions/PersonalMessage.php b/Sources/Actions/PersonalMessage.php index ed6bee49ce..110a86dc00 100644 --- a/Sources/Actions/PersonalMessage.php +++ b/Sources/Actions/PersonalMessage.php @@ -828,7 +828,7 @@ function (&$value, $key) { $value = strtr($value, [ '{scripturl}' => Config::$scripturl, '{boardurl}' => Config::$boardurl, - ]); + ]); } }, ); diff --git a/Sources/Actions/Profile/GroupMembership.php b/Sources/Actions/Profile/GroupMembership.php index 7b9aa5ca27..6caba5ef60 100644 --- a/Sources/Actions/Profile/GroupMembership.php +++ b/Sources/Actions/Profile/GroupMembership.php @@ -107,8 +107,8 @@ public function show(): void ); $open_requests = Db::$db->fetch_all($request); Db::$db->free_result($request); - - $open_requests = array_map(function($request) { + + $open_requests = array_map(function ($request) { return (int) $request['id_group']; }, $open_requests); diff --git a/Sources/Actions/Register2.php b/Sources/Actions/Register2.php index 7544497343..37b0549224 100644 --- a/Sources/Actions/Register2.php +++ b/Sources/Actions/Register2.php @@ -394,7 +394,7 @@ function (&$value, $key) { return; } - /** @var int $member_id */ + /* @var int $member_id */ // Do our spam protection now. Security::spamProtection('register'); diff --git a/Sources/Actions/TopicMerge.php b/Sources/Actions/TopicMerge.php index 1008c1daf5..c9cf87a0d3 100644 --- a/Sources/Actions/TopicMerge.php +++ b/Sources/Actions/TopicMerge.php @@ -493,6 +493,7 @@ public function merge(): void ); $num_replies = 0; + while ($row = Db::$db->fetch_assoc($request)) { // If this is approved, or is fully unapproved. if ($row['approved'] || !empty($first_msg)) { diff --git a/Sources/Actions/TopicRemove.php b/Sources/Actions/TopicRemove.php index c5244645fa..58e5462c70 100644 --- a/Sources/Actions/TopicRemove.php +++ b/Sources/Actions/TopicRemove.php @@ -170,6 +170,7 @@ public static function removeDeleteConcurrence(): bool } ErrorHandler::fatalLang('post_already_deleted', false, [$confirm_url]); + return false; } diff --git a/Sources/Actions/XmlHttp.php b/Sources/Actions/XmlHttp.php index 83d89b5444..cb367adf4e 100644 --- a/Sources/Actions/XmlHttp.php +++ b/Sources/Actions/XmlHttp.php @@ -151,6 +151,7 @@ public function previews(): ?bool } call_user_func([$this, $_POST['item']]); + return null; } diff --git a/Sources/Alert.php b/Sources/Alert.php index 780bfe6dc4..23aaf74415 100644 --- a/Sources/Alert.php +++ b/Sources/Alert.php @@ -672,8 +672,8 @@ public static function createBatch(array $props_batch = []): array $inserts[$alert->id] = [ $alert->timestamp, $alert->member, - isset($alert->member_started) ? $alert->member_started : 0, - isset($alert->member_name) ? $alert->member_name : '', + $alert->member_started ?? 0, + $alert->member_name ?? '', $alert->content_type, $alert->content_id, $alert->content_action, diff --git a/Sources/Cache/CacheApi.php b/Sources/Cache/CacheApi.php index 360291af02..5cb698296a 100644 --- a/Sources/Cache/CacheApi.php +++ b/Sources/Cache/CacheApi.php @@ -602,11 +602,14 @@ final public static function get(string $key, int $ttl = 120): mixed if (empty($value)) { return null; - } else if (is_string($value)) { + } + + if (is_string($value)) { return Utils::jsonDecode($value, true); - } else { - return $value; } + + return $value; + } } diff --git a/Sources/Group.php b/Sources/Group.php index d7cb75f50b..ec236b6007 100644 --- a/Sources/Group.php +++ b/Sources/Group.php @@ -1018,7 +1018,7 @@ public function addMembers(int|array $members, string $type = 'auto', bool $perm $set_primary = []; $set_additional = []; - /** @var \SMF\User $member */ + /* @var \SMF\User $member */ foreach ($members as $key => $id_member) { // Forcing primary. @@ -1195,7 +1195,7 @@ public function removeMembers(int|array $members, bool $perms_checked = false, b // Load the user info for the members being removed. $members = User::load($members, User::LOAD_BY_ID, 'minimal'); - $members = array_map(function (\SMF\User $mem){ + $members = array_map(function (\SMF\User $mem) { return $mem->id; }, $members); diff --git a/Sources/Profile.php b/Sources/Profile.php index 87f03340b6..534f63609f 100644 --- a/Sources/Profile.php +++ b/Sources/Profile.php @@ -1390,7 +1390,7 @@ public function loadAssignableGroups(): bool 'can_be_primary' => true, ], ]; - + // Do not use array merge here, does not maintain key association. Utils::$context['member_groups'] += $this->assignable_groups; diff --git a/Sources/Search/SearchApiInterface.php b/Sources/Search/SearchApiInterface.php index 8cc11b4859..88611e3f2e 100644 --- a/Sources/Search/SearchApiInterface.php +++ b/Sources/Search/SearchApiInterface.php @@ -109,8 +109,8 @@ public function topicsRemoved(array $topics): void; /** * Callback when a topic is merged. * - * @param int $id_topic The ID of the topic that messages where merged into * @param array $topics The ID(s) of the merged topic(s) + * @param int $id_topic The ID of the topic that messages where merged into * @param array $msgs The ID(s) of the merged messages(s) * @param ?string Optional rename all subjects for all messages. */ diff --git a/Sources/Utils.php b/Sources/Utils.php index 4d4762114a..1545ef78c8 100644 --- a/Sources/Utils.php +++ b/Sources/Utils.php @@ -1246,9 +1246,8 @@ public static function jsonDecode(string $json, ?bool $associative = null, int $ // We do this to align with PHP's default when the JSON_THROW_ON_ERROR flag is specified try { $return_value = json_decode($json, $associative, $depth, $flags); - } - catch (\Exception $excepection){ - if (($flags & JSON_THROW_ON_ERROR) == JSON_THROW_ON_ERROR){ + } catch (\Exception $excepection) { + if (($flags & JSON_THROW_ON_ERROR) == JSON_THROW_ON_ERROR) { throw $excepection; } } @@ -2280,18 +2279,19 @@ public static function getCallable(mixed $input, ?bool $ignore_errors = null): m /** * Makes call to the Server API (SAPI) to increase the time limit. - * + * * @param int $limit Requested amount of time, defaults to 600 seconds. */ - public static function sapiSetTimeLimit(int $limit = 600){ + public static function sapiSetTimeLimit(int $limit = 600) + { try { set_time_limit($limit); + } catch (Exception $e) { } - catch (Exception $e) {} } /** * Makes call to the Server API (SAPI) to reset the timeout. - * + * * @suppress PHP0417 */ public static function sapiResetTimeout() @@ -2299,8 +2299,8 @@ public static function sapiResetTimeout() if (!empty(Utils::$context['server']['is_apache']) && function_exists('apache_reset_timeout')) { try { apache_reset_timeout(); + } catch (Exception $e) { } - catch (Exception $e) {} } }