Skip to content

Undefined variable error may sometimes occur when dealing with RRD output#5773

Closed
MSS970 wants to merge 1 commit intoCacti:developfrom
MSS970:patch-1
Closed

Undefined variable error may sometimes occur when dealing with RRD output#5773
MSS970 wants to merge 1 commit intoCacti:developfrom
MSS970:patch-1

Conversation

@MSS970
Copy link
Copy Markdown
Contributor

@MSS970 MSS970 commented Jun 20, 2024

Update rrd.php missing variable $okpos

Update rrd.php missing variable $okpos
@TheWitness
Copy link
Copy Markdown
Member

Can you redo this for 1.2.x branch or is it fine there?

@MSS970
Copy link
Copy Markdown
Contributor Author

MSS970 commented Jun 20, 2024

I have been using Cacti 1.3 (Dev) for long time on Windows and did not test this issue on 1.2.x

@MSS970
Copy link
Copy Markdown
Contributor Author

MSS970 commented Jun 20, 2024

I presume it is the same issue in Cacti 1.2.x, just checked the 1.2.x branch:

function rrdtool_trim_output(&$output) {
global $config;

/* When using RRDtool with proc_open for long strings
 * and using the '-' to handle standard in from inside
 * the process, RRDtool automatically appends stderr
 * to stdout for batch programs to parse the output
 * string.  So, therefore, we have to prune that
 * output.
 */
if ($config['cacti_server_os'] == 'win32') {
	$output = rtrim($output, "OK \n\r");

/* MSS: missing variable here */
} else {
$okpos = strrpos($output, 'OK u:');
if ($okpos !== false) {
$output = substr($output, 0, $okpos);
}
}
}

TheWitness added a commit that referenced this pull request Jun 20, 2024
@TheWitness
Copy link
Copy Markdown
Member

Okay, I fixed this in 1.2.x and will cherry pick into 1.3 shortly.

@TheWitness TheWitness closed this Jun 20, 2024
TheWitness added a commit that referenced this pull request Jun 20, 2024
@MSS970 MSS970 deleted the patch-1 branch June 21, 2024 10:55
@github-actions github-actions bot locked and limited conversation to collaborators Sep 21, 2024
@netniV netniV changed the title Update rrd.php missing variable $okpos Undefined variable error may sometimes occur when dealing with RRD output Sep 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants