Skip to content

refactor: safe PHP 7.4 modernization - #43

Draft
somethingwithproof wants to merge 7 commits into
Cacti:developfrom
somethingwithproof:refactor/modernization
Draft

refactor: safe PHP 7.4 modernization#43
somethingwithproof wants to merge 7 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:15

Copilot AI left a comment

Copy link
Copy Markdown

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 HMIB plugin’s PHP code by enabling strict typing and updating legacy array syntax to PHP 7.4-friendly constructs across core entrypoints, pollers, SNMP helpers, and locale/template index stubs.

Changes:

  • Added declare(strict_types=1); to multiple PHP entrypoints/files.
  • Replaced array(...) with short array syntax [...] in various functions (DB calls, config arrays, helpers).
  • Introduced two .omc/sessions/*.json files into the repo.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
templates/index.php Adds strict types declaration.
snmp.php Adds strict types; converts arrays; introduces invalid is_[...] syntax (parse errors).
snmp_functions.php Adds strict types declaration.
setup.php Adds strict types; converts arrays to short syntax.
poller_hmib.php Converts prepared-statement parameter arrays to short syntax.
poller_graphs.php Converts prepared-statement parameter arrays and local arrays to short syntax.
locales/LC_MESSAGES/index.php Adds strict types declaration.
locales/index.php Adds strict types declaration.
index.php Adds strict types declaration.
hmib.php Converts many filter/config arrays to short syntax.
hmib_types.php Adds strict types; converts arrays; introduces invalid is_[...] / in_[...] syntax (parse errors).
.omc/sessions/df36c0d4-5118-49a8-b66b-5f851e645aa8.json New tooling/session artifact committed (should not be in source).
.omc/sessions/c0ab85d1-d888-4fad-b941-516cdad3f729.json New tooling/session artifact committed (should not be in source).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread snmp.php
Comment thread snmp.php Outdated
Comment thread snmp.php Outdated
Comment thread snmp.php Outdated
Comment thread hmib_types.php Outdated
Comment thread hmib_types.php Outdated
Comment thread .omc/sessions/df36c0d4-5118-49a8-b66b-5f851e645aa8.json Outdated
Comment thread .omc/sessions/c0ab85d1-d888-4fad-b941-516cdad3f729.json Outdated
@somethingwithproof
somethingwithproof marked this pull request as draft April 11, 2026 00:09
@somethingwithproof

Copy link
Copy Markdown
Author

Converted to draft to serialize the stack in this repo. Blocked by #40; will un-draft after that merges to avoid cross-PR merge conflicts.

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>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@somethingwithproof

Copy link
Copy Markdown
Author

Verified all 8 Copilot findings against the current diff: the is_[$var]/in_[$var] parse-error patterns they flagged were already fixed by 97b5816 and cde19ce (same PR), and the .omc/sessions/*.json artifacts they flagged are no longer in the tree. Confirmed with php -l on snmp.php and hmib_types.php plus a manual grep for each flagged line. Resolved all 8 threads as stale.

Cherry-picked the CI workflow from #40 (11ffc52, 9e4dbb6) so this branch gets integration test coverage instead of ci=NONE, then hardened it: added permissions: contents: read and pinned actions/checkout and shivammathur/setup-php to commit SHA.

Branch is not behind develop (0 commits).

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