From 76e7b8b119b2130141dc70c8e52c02ced6739d18 Mon Sep 17 00:00:00 2001 From: TheWitness Date: Tue, 6 Oct 2026 13:17:48 -0400 Subject: [PATCH] Fix html_nav_bar() TypeError by casting paging args to int --- CHANGELOG.md | 1 + maint.php | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ba67bc..cce5507 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ --- develop --- +* issue: Fix an uncaught `TypeError` from `html_nav_bar()` (the schedules, devices, webseer and servcheck lists passed the `page`/`rows`/`total_rows` request values as strings, which the typed core signature rejects under `declare(strict_types=1)`); the paging arguments are now cast to `int` * refactor: Move schema management into includes/database.php (the thold model) and relocate functions.php into includes/; setup.php delegates via require_once, and plugin_maint_check_upgrade() now refreshes the schema via db_update_table(), re-registers the is_device_in_maintenance hook against includes/functions.php, and updates the full plugin_config row on a version change. Switches every file inclusion from include/include_once to require/require_once * dev: Enforce patch coverage of changed lines in CI and remove the inert COMPOSER_ROOT_VERSION env from the Pest step * feature: Add a standard Cacti search filter to the Maintenance Schedules list that also matches the hostname/description/location/site name of associated Thold devices and the hostname/description of associated Servcheck tests diff --git a/maint.php b/maint.php index 2eee730..d5a8bf9 100644 --- a/maint.php +++ b/maint.php @@ -1147,7 +1147,7 @@ function clearFilter() { html_end_box(); - $nav = html_nav_bar('maint.php', MAX_DISPLAY_PAGES, get_request_var('page'), $rows, $total_rows, 8, __('Schedules', 'maint'), 'page', 'main'); + $nav = html_nav_bar('maint.php', MAX_DISPLAY_PAGES, (int) get_request_var('page'), (int) $rows, (int) $total_rows, 8, __('Schedules', 'maint'), 'page', 'main'); form_start('maint.php', 'chk'); @@ -1754,7 +1754,7 @@ function clearFilter() { ]; // generate page list - $nav = html_nav_bar('maint.php?action=edit&tab=hosts&id=' . get_request_var('id'), MAX_DISPLAY_PAGES, get_request_var('page'), $rows, $total_rows, 13, __('Devices', 'maint'), 'page', 'main'); + $nav = html_nav_bar('maint.php?action=edit&tab=hosts&id=' . get_request_var('id'), MAX_DISPLAY_PAGES, (int) get_request_var('page'), (int) $rows, (int) $total_rows, 13, __('Devices', 'maint'), 'page', 'main'); form_start('maint.php', 'chk'); @@ -2022,7 +2022,7 @@ function clearFilter() { $urls = []; } - $nav = html_nav_bar('maint.php?action=edit&tab=webseer&id=' . get_request_var('id'), MAX_DISPLAY_PAGES, get_request_var('page'), $rows, $total_rows, 13, __('URLS', 'maint'), 'page', 'main'); + $nav = html_nav_bar('maint.php?action=edit&tab=webseer&id=' . get_request_var('id'), MAX_DISPLAY_PAGES, (int) get_request_var('page'), (int) $rows, (int) $total_rows, 13, __('URLS', 'maint'), 'page', 'main'); form_start('maint.php', 'chk'); @@ -2309,7 +2309,7 @@ function clearFilter() { $tests = []; } - $nav = html_nav_bar('maint.php?action=edit&tab=servcheck&id=' . get_request_var('id'), MAX_DISPLAY_PAGES, get_request_var('page'), $rows, $total_rows, 13, __('Tests', 'maint'), 'page', 'main'); + $nav = html_nav_bar('maint.php?action=edit&tab=servcheck&id=' . get_request_var('id'), MAX_DISPLAY_PAGES, (int) get_request_var('page'), (int) $rows, (int) $total_rows, 13, __('Tests', 'maint'), 'page', 'main'); form_start('maint.php', 'chk');