Skip to content

Fix TypeError in boost_graph_set_file when sending reports#7268

Open
somethingwithproof wants to merge 6 commits into
Cacti:developfrom
somethingwithproof:fix/reports-rra-id-typeerror
Open

Fix TypeError in boost_graph_set_file when sending reports#7268
somethingwithproof wants to merge 6 commits into
Cacti:developfrom
somethingwithproof:fix/reports-rra-id-typeerror

Conversation

@somethingwithproof

Copy link
Copy Markdown
Contributor

Fixes #7214

lib/reports.php and graph_realtime.php pass '' for rra_id. rrdtool_function_graph() forwards it to boost_graph_set_file(), whose int|null signature throws a TypeError, so scheduled and Send Now reports fail. This normalizes rra_id to int or null once at the top of rrdtool_function_graph(); null keeps the existing best-fit RRA selection.

Verification: new tests/Unit/RrdRraIdNormalizationTest.php and tests/integration/RrdBoostRraIdContractTest.php pass (Pest); php-cs-fixer and PHPStan pre-commit checks pass.

Copilot AI review requested due to automatic review settings July 11, 2026 23:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes report/real-time graph rendering failures caused by passing '' as $rra_id into Boost functions that now require int|null (PHP 8+ type enforcement). The change centralizes $rra_id normalization in rrdtool_function_graph() and adds regression/contract tests to prevent reintroduction.

Changes:

  • Normalize $rra_id at the top of rrdtool_function_graph() to avoid TypeError when Boost caching is involved.
  • Add Pest source-scan/contract tests to enforce the normalization and Boost signature expectations.
  • Document the fix in CHANGELOG under issue #7214.

Reviewed changes

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

File Description
lib/rrd.php Normalizes $rra_id before Boost cache/set calls to prevent TypeError during report/send-now rendering.
tests/Unit/RrdRraIdNormalizationTest.php Adds source-scan/unit coverage ensuring normalization exists and precedes Boost usage.
tests/integration/RrdBoostRraIdContractTest.php Adds cross-file contract checks for Boost signature and the report→rrd→boost $rra_id path.
CHANGELOG Records the issue fix for #7214.

Comment thread lib/rrd.php
Comment thread tests/Unit/RrdRraIdNormalizationTest.php Outdated
Comment thread tests/Unit/RrdRraIdNormalizationTest.php Outdated
Comment thread tests/integration/RrdBoostRraIdContractTest.php Outdated
@somethingwithproof somethingwithproof added the develop Bug in the development branch label Jul 12, 2026

@TheWitness TheWitness left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please resolve the conflicts in the CHANGELOG

@somethingwithproof
somethingwithproof force-pushed the fix/reports-rra-id-typeerror branch from b2905c5 to 9227e0e Compare July 14, 2026 02:43
@somethingwithproof
somethingwithproof requested a review from a team as a code owner July 14, 2026 02:43
@somethingwithproof
somethingwithproof requested review from cigamit and removed request for a team July 14, 2026 02:43
@somethingwithproof somethingwithproof added the reports Reports related issue label Jul 14, 2026
@somethingwithproof somethingwithproof self-assigned this Jul 14, 2026
@somethingwithproof

Copy link
Copy Markdown
Contributor Author

Updated CHANGELOG: the #7214 issue entry is now in the established 1.3.0-dev issue ordering.

@somethingwithproof

Copy link
Copy Markdown
Contributor Author

Corrected the CHANGELOG placement: issue entries are now in the 1.3.0-dev issue block before feature entries, preserving the repository convention.

@somethingwithproof

Copy link
Copy Markdown
Contributor Author

Re-verified the CHANGELOG: issue #7214 is the final issue entry before the feature block, with the required numbered format. No changelog blocker remains.

@TheWitness

Copy link
Copy Markdown
Member

@somethingwithproof more Merge Conflicts due to the misapplied rule.

@somethingwithproof

Copy link
Copy Markdown
Contributor Author

@copilot review

reports.php passes '' for rra_id; normalize to int|null in
rrdtool_function_graph before it reaches boost. Ref Cacti#7214

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@somethingwithproof
somethingwithproof force-pushed the fix/reports-rra-id-typeerror branch from 6f43271 to 21ec245 Compare July 16, 2026 07:04
@somethingwithproof

Copy link
Copy Markdown
Contributor Author

CHANGELOG conflict resolved. Merges clean now.

bmfmancini
bmfmancini previously approved these changes Jul 19, 2026
bmfmancini
bmfmancini previously approved these changes Jul 21, 2026
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@somethingwithproof

Copy link
Copy Markdown
Contributor Author

Merged develop and cleaned up the CHANGELOG, there was a duplicate #7216 entry from the base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

develop Bug in the development branch reports Reports related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scheduled Reports fail to send, and server error is logged

4 participants