Skip to content

refactor: safe PHP 7.4 modernization - #88

Open
somethingwithproof wants to merge 5 commits into
Cacti:developfrom
somethingwithproof:refactor/modernization
Open

refactor: safe PHP 7.4 modernization#88
somethingwithproof wants to merge 5 commits into
Cacti:developfrom
somethingwithproof:refactor/modernization

Conversation

@somethingwithproof

Copy link
Copy Markdown

This PR adds strict typing, short array syntax, and null coalescing operators across the plugin. Standalone infrastructure files were removed per architectural mandate.

Copilot AI review requested due to automatic review settings April 9, 2026 21:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes the servcheck plugin’s PHP code for PHP 7.4 by enabling strict typing and refactoring legacy array() usage to short array syntax, and it adds a unit test covering static array definitions / notify account label building.

Changes:

  • Add declare(strict_types=1); across plugin entrypoints and includes.
  • Replace many array(...) constructs with [...] (and related small syntax modernizations).
  • Add a unit test validating key lookup arrays and notify account label-building behavior.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/Unit/ArraysDefinitionTest.php Adds unit coverage for static arrays and notify account label building logic.
setup.php Adds strict types and modernizes prepared statement argument arrays.
servcheck_test.php Adds strict types and modernizes multiple prepared statement argument arrays and filter config arrays.
servcheck_proxies.php Adds strict types and modernizes local arrays / prepared statement argument arrays.
servcheck_process.php Adds strict types and modernizes prepared statement argument arrays / local arrays.
servcheck_curl_code.php Adds strict types.
servcheck_ca.php Adds strict types and modernizes local arrays / prepared statement argument arrays.
poller_servcheck.php Adds strict types and modernizes prepared statement argument arrays.
locales/po/index.php Adds strict types.
locales/LC_MESSAGES/index.php Adds strict types.
locales/index.php Adds strict types.
index.php Adds strict types.
includes/tests.php Adds strict types and refactors arrays; currently introduces fatal syntax errors in cURL option application.
includes/mxlookup.php Adds strict types and modernizes array initializations.
includes/index.php Adds strict types.
includes/functions.php Adds strict types; currently introduces a fatal syntax error in membership check logic.
includes/constants.php Adds strict types.
includes/arrays.php Adds strict types and modernizes key static arrays / notify accounts initialization and some field definitions.
.omc/sessions/07529e04-df5c-47a5-9f2b-aa71b09610a4.json Adds a tool/session artifact file that likely shouldn’t be committed.
.omc/sessions/01068f21-52fc-4525-83a9-8d76d48b18d4.json Adds a tool/session artifact file that likely shouldn’t be committed.

Comment thread includes/tests.php Outdated
Comment thread includes/tests.php Outdated
Comment thread includes/tests.php Outdated
Comment thread includes/functions.php Outdated
Comment thread .omc/sessions/07529e04-df5c-47a5-9f2b-aa71b09610a4.json Outdated
Comment thread .omc/sessions/01068f21-52fc-4525-83a9-8d76d48b18d4.json Outdated
Revert bulk array()->[] rewrite damage affecting:
- is_array, in_array, xml2array
- call_user_func_array, filter_var_array
- Function declarations with _array suffix

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
…ction declarations

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@somethingwithproof

Copy link
Copy Markdown
Author

Copilot's 6 comments were against d09799b; the corrupted curl_setopt_array/in_array calls and the stray .omc/sessions/*.json files were already fixed by 5a75b27/cfc2fcf and .omc/ is gitignored on this branch now, so I resolved the threads. No Actions runs exist for this branch yet, likely blocked on the first-time-contributor workflow-approval gate. I don't have push access on Cacti/plugin_servcheck to approve it myself; a maintainer will need to approve the run from the Actions tab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants