syntax error in statehistory.php in 2014R2.2 (fix included)
Posted: Fri Dec 26, 2014 9:09 pm
After the update to Nagios XI 2014R2.2 (from 2.1), the frame for State History for a service was blank.
/var/log/httpd/error_log showed:
PHP Parse error: syntax error, unexpected ')', expecting ',' or ';' in /usr/local/nagiosxi/html/reports/statehistory.php on line 909
Editing line 909 of statehistory.php and removing one of the three right parentheses fixed the symptoms.
Original:
909 echo $se->state_time . ",\"" . $host_name . "\",\"" . $service_description . "\"," . $state_chan ge . ",\"" . $state . "\",\"" . $state_type . "\"," . $current_check_attempt . "," . $max_check_attempts . " ," . $last_state . "," . $last_hard_state . ",\"" . str_replace(''', "'", html_entity_decode($output))) . "\"\n";
Fixed:
909 echo $se->state_time . ",\"" . $host_name . "\",\"" . $service_description . "\"," . $state_chan ge . ",\"" . $state . "\",\"" . $state_type . "\"," . $current_check_attempt . "," . $max_check_attempts . " ," . $last_state . "," . $last_hard_state . ",\"" . str_replace(''', "'", html_entity_decode($output)) . "\"\n";
/var/log/httpd/error_log showed:
PHP Parse error: syntax error, unexpected ')', expecting ',' or ';' in /usr/local/nagiosxi/html/reports/statehistory.php on line 909
Editing line 909 of statehistory.php and removing one of the three right parentheses fixed the symptoms.
Original:
909 echo $se->state_time . ",\"" . $host_name . "\",\"" . $service_description . "\"," . $state_chan ge . ",\"" . $state . "\",\"" . $state_type . "\"," . $current_check_attempt . "," . $max_check_attempts . " ," . $last_state . "," . $last_hard_state . ",\"" . str_replace(''', "'", html_entity_decode($output))) . "\"\n";
Fixed:
909 echo $se->state_time . ",\"" . $host_name . "\",\"" . $service_description . "\"," . $state_chan ge . ",\"" . $state . "\",\"" . $state_type . "\"," . $current_check_attempt . "," . $max_check_attempts . " ," . $last_state . "," . $last_hard_state . ",\"" . str_replace(''', "'", html_entity_decode($output)) . "\"\n";