Bug #14513
closed
Improve error handling in ``status.php``
Added by Marcos M about 1 year ago.
Updated 9 months ago.
Plus Target Version:
23.09
Description
The status.php page is typically used when there's an issue with the system. If PHP errors are encountered while generating the diagnostic data, error details can be included as a separate file (e.g. _errors.txt
).
For example, these errors are the result of a failure with fopen()
- details of which could be caught (e.g. with error_get_last()
).
[21-Jun-2023 17:58:10 Etc/UTC] PHP Fatal error: Uncaught TypeError: fclose(): Argument #1 ($stream) must be of type resource, bool given in /usr/local/www/status.php:145
Stack trace:
#0 /usr/local/www/status.php(145): fclose(false)
#1 /usr/local/www/status.php(197): doCmdT('Log-OpenVPN-Las...', '/usr/bin/bzcat ...', 'exec')
#2 /usr/local/www/status.php(499): execCmds()
#3 {main}
thrown in /usr/local/www/status.php on line 145
[21-Jun-2023 17:58:10 Etc/UTC] PHP Fatal error: str_ireplace(): Cannot use output buffering in output buffering display handlers in /usr/local/www/csrf/csrf-magic.php on line 161
[...]
[21-Jun-2023 18:51:53 Etc/UTC] PHP Fatal error: Uncaught TypeError: fclose(): Argument #1 ($stream) must be of type resource, bool given in /usr/local/www/status.php:145
Stack trace:
#0 /usr/local/www/status.php(145): fclose(false)
#1 /usr/local/www/status.php(197): doCmdT('Log-Filter-Last...', '/usr/bin/bzcat ...', 'exec')
#2 /usr/local/www/status.php(499): execCmds()
#3 {main}
thrown in /usr/local/www/status.php on line 145
[21-Jun-2023 18:51:53 Etc/UTC] PHP Fatal error: str_ireplace(): Cannot use output buffering in output buffering display handlers in /usr/local/www/csrf/csrf-magic.php on line 161
- Status changed from New to In Progress
- Assignee set to Jim Pingle
- Target version set to 2.8.0
- Plus Target Version set to 23.09
- Status changed from In Progress to Feedback
- % Done changed from 0 to 100
- Status changed from Feedback to Resolved
Needed one more fix to make sure the error count was right, but now I think it's doing all it can to ensure errors are captured in a non-fatal way and reported properly.
A couple examples:
: php -f /usr/local/www/status.php
Gathering status data...
Errors: 2
Requested log file is not present: /tmp/PHP_errors.log
Failed to execute command (Firewall-Generated Ruleset Limiters): Command had non-zero exit status: 1
NOTE: Some errors are normal if a feature is not enabled or is inaccessible by the current user.
Saving output to archive...Done.
When run as root on a system that doesn't have IPsec or limiters enabled:
: php -f /usr/local/www/status.php
Gathering status data...
Errors: 9
Failed to execute command (Firewall-Generated Ruleset Limiters): Command had non-zero exit status: 1
Failed to execute command (IPsec-strongSwan Configuration): Command had non-zero exit status: 1
Failed to execute command (IPsec-Configuration): Command had non-zero exit status: 1
Failed to execute command (IPsec-Status-Statistics): Command had non-zero exit status: 64
Failed to execute command (IPsec-Status-Connections): Command had non-zero exit status: 64
Failed to execute command (IPsec-Status-Active SAs): Command had non-zero exit status: 64
Failed to execute command (IPsec-Status-Policies): Command had non-zero exit status: 64
Failed to execute command (IPsec-Status-Certificates): Command had non-zero exit status: 64
Failed to execute command (IPsec-Status-Pools): Command had non-zero exit status: 64
NOTE: Some errors are normal if a feature is not enabled or is inaccessible by the current user.
Saving output to archive...Done.
When run on that same system as a non-root user from the shell:
: php -f /usr/local/www/status.php
Gathering status data...
Errors: 41
Requested log file is not readable: /var/log/system.log
Requested log file is not readable: /var/log/dhcpd.log
Requested log file is not readable: /var/log/filter.log
Requested log file is not readable: /var/log/gateways.log
Requested log file is not readable: /var/log/ipsec.log
Requested log file is not readable: /var/log/l2tps.log
Requested log file is not readable: /var/log/ntpd.log
Requested log file is not readable: /var/log/openvpn.log
Requested log file is not readable: /var/log/portalauth.log
Requested log file is not readable: /var/log/ppp.log
Requested log file is not readable: /var/log/poes.log
Requested log file is not readable: /var/log/resolver.log
Requested log file is not readable: /var/log/routing.log
Requested log file is not readable: /var/log/wireless.log
Failed to execute command (Firewall-Generated Ruleset Limiters): Command had non-zero exit status: 1
Failed to execute command (Firewall-pf NAT Rules): Command had non-zero exit status: 1
Failed to execute command (Firewall-pf Firewall Rules): Command had non-zero exit status: 1
Failed to execute command (Firewall-pf Tables): Command had non-zero exit status: 1
Failed to execute command (Firewall-pf State Table Contents): Command had non-zero exit status: 1
Failed to execute command (Firewall-pf Info): Command had non-zero exit status: 1
Failed to execute command (Firewall-pf Show All): Command had non-zero exit status: 1
Failed to execute command (Firewall-pf Queues): Command had non-zero exit status: 1
Failed to execute command (Firewall-pf OSFP): Command had non-zero exit status: 1
Failed to execute command (Firewall-pftop Default): Command had non-zero exit status: 1
Failed to execute command (Firewall-pftop Long): Command had non-zero exit status: 1
Failed to execute command (Firewall-pftop Queue): Command had non-zero exit status: 1
Failed to execute command (Firewall-pftop Rules): Command had non-zero exit status: 1
Failed to execute command (Firewall-pftop Size): Command had non-zero exit status: 1
Failed to execute command (Firewall-pftop Speed): Command had non-zero exit status: 1
Failed to execute command (Firewall-Limiter Info): Command had non-zero exit status: 69
Failed to execute command (Firewall-Queue Info): Command had non-zero exit status: 69
Failed to execute command (IPsec-strongSwan Configuration): Command had non-zero exit status: 1
Failed to execute command (IPsec-Configuration): Command had non-zero exit status: 1
Failed to execute command (IPsec-Status-Statistics): Command had non-zero exit status: 64
Failed to execute command (IPsec-Status-Connections): Command had non-zero exit status: 64
Failed to execute command (IPsec-Status-Active SAs): Command had non-zero exit status: 64
Failed to execute command (IPsec-Status-Policies): Command had non-zero exit status: 64
Failed to execute command (IPsec-Status-Certificates): Command had non-zero exit status: 64
Failed to execute command (IPsec-Status-Pools): Command had non-zero exit status: 64
Failed to execute command (IPsec-SPD): Command had non-zero exit status: 1
Failed to execute command (IPsec-SAD): Command had non-zero exit status: 1
NOTE: Some errors are normal if a feature is not enabled or is inaccessible by the current user.
Saving output to archive...Done.
- Status changed from Resolved to Feedback
Need to wait for a good snapshot build before testing this for sure. The new include file may not have been in this current snapshot but it will be in tomorrow's
Also the current build is missing status_output.inc
which will be in the next build.
- Subject changed from Improve error handling in status.php to Improve error handling in ``status.php``
- Status changed from Feedback to Resolved
Working well on the latest snapshot from both the GUI and console, and from root and non-root users. All have the expected output and no PHP errors/crashes.
- Target version changed from 2.8.0 to 2.7.1
Also available in: Atom
PDF