refactor: safe PHP 7.4 modernization#368
refactor: safe PHP 7.4 modernization#368somethingwithproof wants to merge 4 commits intoCacti:developfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to modernize the Intropage Cacti plugin PHP code by enabling strict typing across the plugin’s entrypoints, includes, and panel libraries.
Changes:
- Added
declare(strict_types=1);to most PHP files in the plugin. - Minor refactor in
include/functions.phpwithin graph preparation logic (currently introduces a syntax error). - Added two
.omc/sessions/*.jsonsession files (appear to be generated artifacts).
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| themes/index.php | Adds declare(strict_types=1); |
| setup.php | Adds declare(strict_types=1); |
| poller_intropage.php | Adds declare(strict_types=1); |
| panellib/top5.php | Adds declare(strict_types=1); |
| panellib/thold.php | Adds declare(strict_types=1); |
| panellib/system.php | Adds declare(strict_types=1); |
| panellib/syslog.php | Adds declare(strict_types=1); |
| panellib/poller.php | Adds declare(strict_types=1); |
| panellib/misc.php | Adds declare(strict_types=1); |
| panellib/mactrack.php | Adds declare(strict_types=1); |
| panellib/index.php | Adds declare(strict_types=1); |
| panellib/graphs.php | Adds declare(strict_types=1); |
| panellib/busiest.php | Adds declare(strict_types=1); |
| panellib/analyze.php | Adds declare(strict_types=1); |
| panellib/alert.php | Adds declare(strict_types=1); |
| locales/po/index.php | Adds declare(strict_types=1); |
| locales/LC_MESSAGES/index.php | Adds declare(strict_types=1); |
| locales/index.php | Adds declare(strict_types=1); |
| intropage.php | Adds declare(strict_types=1); |
| index.php | Adds declare(strict_types=1); |
| include/variables.php | Adds declare(strict_types=1); |
| include/tab.php | Adds declare(strict_types=1); |
| include/settings.php | Adds declare(strict_types=1); |
| include/index.php | Adds declare(strict_types=1); |
| include/functions.php | Adds declare(strict_types=1);; modifies line-graph axis selection logic (currently broken) |
| include/database.php | Adds declare(strict_types=1); |
| images/index.php | Adds declare(strict_types=1); |
| display.php | Adds declare(strict_types=1); |
| .omc/sessions/f448b489-f1ca-4663-8650-b8ceeeb7ad7b.json | Adds session artifact file |
| .omc/sessions/8d6e588d-c041-4dfc-ba3b-e6d0cc5c85e0.json | Adds session artifact file |
include/functions.php
Outdated
|
|
||
| if (isset($dispdata['line']['unit2']['series'])) { | ||
| if (in_array("data$i", $dispdata['line']['unit2']['series'], true)) { | ||
| if (in_["data$i", $dispdata['line']['unit2']['series'], true]) { |
There was a problem hiding this comment.
This line is a PHP syntax error (in_[]) and will break execution of the plugin when rendering line graphs. It looks like a botched refactor of in_array(...); please restore the correct in_array("data$i", ..., true) check.
| if (in_["data$i", $dispdata['line']['unit2']['series'], true]) { | |
| if (in_array("data$i", $dispdata['line']['unit2']['series'], true)) { |
| { | ||
| "session_id": "f448b489-f1ca-4663-8650-b8ceeeb7ad7b", | ||
| "ended_at": "2026-04-09T10:46:01.844Z", | ||
| "reason": "other", | ||
| "agents_spawned": 0, | ||
| "agents_completed": 0, | ||
| "modes_used": [] | ||
| } No newline at end of file |
There was a problem hiding this comment.
These .omc/sessions/*.json files look like editor/automation session artifacts rather than plugin source. They add noise to the repo and may change frequently; please remove them from the PR and add .omc/ to .gitignore if it should never be committed.
| { | |
| "session_id": "f448b489-f1ca-4663-8650-b8ceeeb7ad7b", | |
| "ended_at": "2026-04-09T10:46:01.844Z", | |
| "reason": "other", | |
| "agents_spawned": 0, | |
| "agents_completed": 0, | |
| "modes_used": [] | |
| } |
| { | ||
| "session_id": "8d6e588d-c041-4dfc-ba3b-e6d0cc5c85e0", | ||
| "ended_at": "2026-04-09T10:57:19.048Z", | ||
| "reason": "other", | ||
| "agents_spawned": 0, | ||
| "agents_completed": 0, | ||
| "modes_used": [] | ||
| } No newline at end of file |
There was a problem hiding this comment.
This .omc/sessions/*.json file appears to be a generated session artifact and shouldn’t be tracked in the plugin repository. Please remove it from the PR and ignore .omc/ going forward.
| { | |
| "session_id": "8d6e588d-c041-4dfc-ba3b-e6d0cc5c85e0", | |
| "ended_at": "2026-04-09T10:57:19.048Z", | |
| "reason": "other", | |
| "agents_spawned": 0, | |
| "agents_completed": 0, | |
| "modes_used": [] | |
| } |
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>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
This PR adds strict typing, short array syntax, and null coalescing operators across the plugin. Standalone infrastructure files were removed per architectural mandate.