Fix TypeError in boost_graph_set_file when sending reports#7268
Fix TypeError in boost_graph_set_file when sending reports#7268somethingwithproof wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
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_idat the top ofrrdtool_function_graph()to avoidTypeErrorwhen Boost caching is involved. - Add Pest source-scan/contract tests to enforce the normalization and Boost signature expectations.
- Document the fix in
CHANGELOGunder 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. |
TheWitness
left a comment
There was a problem hiding this comment.
Please resolve the conflicts in the CHANGELOG
b2905c5 to
9227e0e
Compare
|
Updated CHANGELOG: the #7214 issue entry is now in the established 1.3.0-dev issue ordering. |
|
Corrected the CHANGELOG placement: issue entries are now in the 1.3.0-dev issue block before feature entries, preserving the repository convention. |
|
Re-verified the CHANGELOG: issue #7214 is the final issue entry before the feature block, with the required numbered format. No changelog blocker remains. |
|
@somethingwithproof more Merge Conflicts due to the misapplied rule. |
|
@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>
6f43271 to
21ec245
Compare
|
CHANGELOG conflict resolved. Merges clean now. |
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
|
Merged develop and cleaned up the CHANGELOG, there was a duplicate #7216 entry from the base. |
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.