Skip to content

refactor: safe PHP 7.4 modernization - #54

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

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

Conversation

@somethingwithproof

Copy link
Copy Markdown
Member

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 Cacti Audit plugin’s PHP sources by enabling strict typing and updating some legacy array syntax, with the goal of safer/cleaner PHP 7.4-era code.

Changes:

  • Added declare(strict_types=1); to multiple PHP entrypoint files.
  • Converted some array(...) usages to short array syntax [...].
  • Introduced additional input/type guarding in audit_process_page_data().

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
setup.php Adds strict types and short array syntax; currently contains a PHP parse error in audit_utilities_array declaration.
audit.php Adds strict types and short array syntax; currently contains PHP parse errors in is_array checks.
audit_functions.php Adds strict types, short array syntax, and new guard logic; currently contains a PHP parse error in the guard clause.
index.php Adds strict types to plugin index redirect.
locales/index.php Adds strict types to locales index redirect.
locales/LC_MESSAGES/index.php Adds strict types to LC_MESSAGES index redirect.
.omc/sessions/*.json Adds session metadata files that appear unrelated to plugin runtime and should not be committed.

Comment thread setup.php Outdated
Comment thread audit.php Outdated
Comment thread audit.php Outdated
Comment thread audit_functions.php Outdated
Comment thread .omc/sessions/e795e842-5b52-4c4f-a301-d0c076c145ec.json Outdated
Comment thread .omc/sessions/d67358a1-81fd-4c38-8750-7175bf018252.json Outdated
Comment thread .omc/sessions/865e7e69-4115-4c88-a9ea-8264b75b1cfc.json Outdated
Comment thread .omc/sessions/426d31d2-5007-4a69-94e9-7171c89be435.json Outdated
Comment thread .omc/sessions/0ad57977-0b9b-4712-bf0c-d8591161a6c5.json Outdated
@somethingwithproof
somethingwithproof marked this pull request as draft April 11, 2026 00:09
@somethingwithproof

Copy link
Copy Markdown
Member Author

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

Guard against non-string $page and non-array $selected_items
at the function boundary to prevent unexpected behavior from
malformed caller data.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Revert corrupted function calls introduced by refactoring tool:
- is_[$x] -> is_array($x)
- in_[$x, ...] -> in_array($x, ...)
- xml2[$x] -> xml2array($x)

Also remove accidentally committed .omc session files and add
.omc/ to .gitignore.

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