Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from

Conversation

MSS970
Copy link

@MSS970 MSS970 commented Jun 20, 2024

Update rrd.php missing variable $okpos

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

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

@MSS970
Copy link
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
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
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