Skip to content

Plugin declares compat 1.2.20 but audit_syslog.php needs PHP 8.0 #66

Description

@somethingwithproof

INFO declares compat = 1.2.20, and Cacti 1.2.x supports PHP 7.4. Two files on
develop use PHP 8.0 syntax, so installing on such a server fails at parse time
rather than reporting a version mismatch.

Linting the tree on a pinned php:7.4-cli container:

Parse error: syntax error, unexpected '|', expecting variable in ./phpstan/stubs/cacti.stubs.php on line 94
Parse error: syntax error, unexpected '|', expecting '{' in ./audit_syslog.php on line 623

audit_syslog.php:623:

function audit_syslog_fwrite(mixed $socket, string $message, string &$warning = ''): int|false {

mixed and int|false are both 8.0+. The stub file is dev-only and not loaded at
runtime, so audit_syslog.php is the one that matters.

These arrived with #63. tests/Security/Php74CompatibilityTest.php was removed in the
same change and replaced by tests/Security/Php81SyntaxTest.php, which states the
plugin targets 8.1+. The CI matrix runs 8.1 through 8.4, so nothing exercises the
floor that INFO advertises.

Two ways to close the gap, depending on which is intended:

  • If 8.0+ is the intended floor, raise compat to a Cacti release whose PHP floor
    matches, note the requirement in README.md, and add a PHP_VERSION_ID guard in
    setup.php so an old server gets a message instead of a fatal.
  • If 1.2.20 support is still wanted, restore 7.4-compatible signatures in
    audit_syslog.php and add a lint job on 7.4 to keep it that way.

Happy to send a PR for either once you pick.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions