From 2f6f4098e15318f28cff8f1d64d7017c8f09e88f Mon Sep 17 00:00:00 2001 From: TheWitness Date: Thu, 8 Oct 2026 14:51:13 -0400 Subject: [PATCH 1/2] bug: pass bool (not int) to api_plugin_register_hook() enable argument Cacti 1.3 types api_plugin_register_hook() 5th arg as bool enable. These calls passed int 1, which only coerces while the file lacks declare(strict_types=1); pass true so they stay type-correct. php -l clean. --- CHANGELOG.md | 1 + setup.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5f37a1..14edb03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ --- develop --- +* bug: Pass a boolean (not the integer 1) to api_plugin_register_hook()'s $enable argument so the hook registration stays type-correct under Cacti 1.3's strict bool type-hint (the int only coerces while the file lacks declare(strict_types=1)) * security: Move the graph 'Add to QuickTree' icon's inline `onClick='addQuickTree()'` handler into a delegated jQuery binding in `js/quicktree.js` (via a `quicktreeAddLink` class and `data-` attributes) and replace the confirmation pages' inline `onClick='cactiReturnTo()'` Cancel buttons with the CSP-safe `cactiReturnTo` class, so the pages no longer trip Cacti's Content-Security-Policy script-src-attr directive * dev: Replace the translation-template CI check that regenerated locales/po/cacti.pot and compared it with a diff-based gate (tests/bin/check-i18n-pot.php) requiring cacti.pot to be updated only when a pull request adds, removes, or modifies an i18n function call * dev: Measure CI coverage with xdebug instead of pcov so the plugin's own sources are instrumented (pcov auto-scopes to the Composer root and skipped cacti/plugins/, leaving the patch-coverage gate with nothing to measure) diff --git a/setup.php b/setup.php index d43b47f..abd4931 100644 --- a/setup.php +++ b/setup.php @@ -423,7 +423,7 @@ function quicktree_check_upgrade(): void { ['quicktree']); if ($current != $old) { - api_plugin_register_hook('quicktree', 'page_head', 'quicktree_page_head', 'setup.php', 1); + api_plugin_register_hook('quicktree', 'page_head', 'quicktree_page_head', 'setup.php', true); quicktree_setup_table(); From a40672f7a26142d1995fa4699994455816aa4a12 Mon Sep 17 00:00:00 2001 From: TheWitness Date: Thu, 8 Oct 2026 15:31:32 -0400 Subject: [PATCH 2/2] test: expect bool true (not int 1) for re-enabled page_head hook The quicktree_check_upgrade() version-drift branch now passes true (not 1) to api_plugin_register_hook()'s $enable argument, matching Cacti 1.3's strict bool type-hint. Update the assertion to compare against true so the Pest unit test reflects the corrected call. --- tests/Unit/QuicktreeCheckUpgradeTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Unit/QuicktreeCheckUpgradeTest.php b/tests/Unit/QuicktreeCheckUpgradeTest.php index e39321c..3e69d4f 100644 --- a/tests/Unit/QuicktreeCheckUpgradeTest.php +++ b/tests/Unit/QuicktreeCheckUpgradeTest.php @@ -1,4 +1,4 @@ -not->toBeEmpty();