Skip to content

bugfix: trim xml import payload value before emptiness check#272

Open
somethingwithproof wants to merge 1 commit intoCacti:developfrom
somethingwithproof:bug/import-text-trim-check
Open

bugfix: trim xml import payload value before emptiness check#272
somethingwithproof wants to merge 1 commit intoCacti:developfrom
somethingwithproof:bug/import-text-trim-check

Conversation

@somethingwithproof
Copy link
Contributor

Summary

Fixes #269

Validation

  • php -l syslog_alerts.php
  • php -l syslog_reports.php
  • php -l syslog_removal.php
  • php -l tests/regression/issue269_import_text_trim_check_test.php
  • php tests/regression/issue269_import_text_trim_check_test.php

Copilot AI review requested due to automatic review settings March 7, 2026 02:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a long-standing operator-precedence bug in the Syslog plugin’s XML import handlers so that whitespace-only import_text payloads are treated as empty (instead of incorrectly passing the check), and adds a regression test plus changelog entry for issue #269.

Changes:

  • Corrected the import_text emptiness check to trim the request value before comparing in alert/report/removal import handlers.
  • Added a regression script to detect reintroduction of the legacy buggy pattern across the three handlers.
  • Updated the changelog to note issue #269.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
syslog_alerts.php Fixes the import_text trim/compare condition in alert_import()
syslog_reports.php Fixes the import_text trim/compare condition in report_import()
syslog_removal.php Fixes the import_text trim/compare condition in removal_import()
tests/regression/issue269_import_text_trim_check_test.php Adds a regression check to ensure the legacy buggy pattern is not present
CHANGELOG.md Documents issue #269 in the develop section

@somethingwithproof
Copy link
Contributor Author

Fixed -- get_nfilter_request_var('import_text') is now called once, stored in $import_text, and reused for both the trim check and $xml_data assignment.

@somethingwithproof somethingwithproof force-pushed the bug/import-text-trim-check branch 2 times, most recently from 74b6927 to a718125 Compare March 10, 2026 20:30
somethingwithproof added a commit to somethingwithproof/plugin_syslog that referenced this pull request Mar 10, 2026
Refs Cacti#272

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@somethingwithproof somethingwithproof force-pushed the bug/import-text-trim-check branch from a718125 to d55cae3 Compare March 10, 2026 20:55
somethingwithproof added a commit to somethingwithproof/plugin_syslog that referenced this pull request Mar 15, 2026
Refs Cacti#272

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@somethingwithproof somethingwithproof force-pushed the bug/import-text-trim-check branch from d55cae3 to c81c438 Compare March 15, 2026 05:17
TheWitness
TheWitness previously approved these changes Mar 16, 2026
Refs Cacti#272

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Copy link
Member

@TheWitness TheWitness left a comment

Choose a reason for hiding this comment

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

More merge conflicts.

@somethingwithproof somethingwithproof force-pushed the bug/import-text-trim-check branch from a152c5f to b577308 Compare March 16, 2026 20:59
Copy link
Member

@TheWitness TheWitness left a comment

Choose a reason for hiding this comment

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

We use only print, not echo. This may not pass the phpcsfixer. Let's see.

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.

bug: import XML text emptiness check trims boolean instead of payload

3 participants