Repository navigation
fix: load lib/poller.php before the process-helper compat shims - #476
Merged
Merged
Conversation
The function_exists() guards around the cacti_process_still_running() and cacti_process_kill() fallbacks only defer to core when lib/poller.php is already loaded. syslog_check_upgrade() loads includes/functions.php via syslog_connect() and later include_once's lib/poller.php, so on Cacti 1.2.32+ the shim was declared first and core then fataled with "Cannot redeclare cacti_process_still_running()". Include core's lib/poller.php ahead of the shims so the native helpers win when present and the fallbacks still apply on older releases. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change that loads Cacti’s process helpers before compatibility shims.
No open issues 🎉
What changed in this PR
Fixes a process-helper redeclaration fatal during Syslog plugin installation and upgrade checks by loading Cacti’s poller library before defining compatibility shims.
Changes:
- Conditionally loads
lib/poller.phpso native helpers take precedence while preserving fallback shims for older Cacti versions. - Documents the fix in the changelog.
| File | Description |
|---|---|
includes/functions.php |
Loads core process helpers before the compatibility guards. |
CHANGELOG.md |
Records the fix for the redeclaration fatal on Cacti 1.2.32+. |
Review effort: Balanced
bmfmancini
approved these changes
Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Fixes a fatal error seen in Cacti CI (e.g. Cacti/cacti#8859):
Root cause
The
cacti_process_still_running()/cacti_process_kill()compatibility shims inincludes/functions.phpare wrapped infunction_exists()guards. Those guards only defer to core whenlib/poller.phphas already been loaded, but core declares the functions unconditionally.syslog_check_upgrade()callssyslog_connect(), whichrequire_oncesincludes/functions.php. At that pointlib/poller.phpis not loaded yet, so the shim is declared. The function then callsinclude_once lib/poller.php(setup.php lines 1093 and 1242), and on Cacti 1.2.32+ core fatals on the redeclaration. This happens while the plugin is installed or upgraded, which is why every PHP matrix job in Cacti's CI failed.Fix
Load core's
lib/poller.phpbefore the shims whencacti_process_still_running()is not yet defined:lib/poller.phplacks the helpers, so the shims still apply.cacti_process_still_running(), so core is not pulled into the isolated test harness.Testing
1.2.xby loadingincludes/functions.phpand theninclude_once lib/poller.php. With this change the function now comes from corelib/poller.phpand the fatal is gone.php -l includes/functions.phppasses.1.2.x: 852 passed (1 warning that was already there), identical todevelop.