diff options
author | jim-p <jimp@pfsense.org> | 2011-11-23 10:18:29 -0500 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2011-11-23 10:23:36 -0500 |
commit | dc43ff1eaa74ddbdc8fbdf4b088cbd487631e8c7 (patch) | |
tree | de84c4a5eecb34cb10c43ec99a35024864268314 | |
parent | 96f9e3fab1277ef03c1e4190d76b2c72666bd9c2 (diff) | |
download | pfsense-dc43ff1eaa74ddbdc8fbdf4b088cbd487631e8c7.zip pfsense-dc43ff1eaa74ddbdc8fbdf4b088cbd487631e8c7.tar.gz |
Show the PHP errors reported on the index page in the crash report so users are not confused by an empty report screen. Include them in the report and also clear them after sending.
-rwxr-xr-x | usr/local/www/crash_reporter.php | 10 | ||||
-rwxr-xr-x | usr/local/www/index.php | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/usr/local/www/crash_reporter.php b/usr/local/www/crash_reporter.php index 924532c..a8d1345 100755 --- a/usr/local/www/crash_reporter.php +++ b/usr/local/www/crash_reporter.php @@ -88,6 +88,8 @@ $crash_report_header .= php_uname("r") . "\n"; $crash_report_header .= php_uname("v") . "\n"; $crash_report_header .= "\nCrash report details:\n"; +exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors); + ?> <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> @@ -100,9 +102,9 @@ $crash_report_header .= "\nCrash report details:\n"; if (gettext($_POST['Submit']) == "Yes") { echo gettext("Processing..."); file_put_contents("/var/crash/crashreport_header.txt", $crash_report_header); - exec("/usr/bin/gzip /var/crash/*"); if(file_exists("/tmp/PHP_errors.log")) exec("cp /tmp/PHP_errors.log /var/crash/"); + exec("/usr/bin/gzip /var/crash/*"); $files_to_upload = glob("/var/crash/*"); echo "<p/>"; echo gettext("Uploading..."); @@ -111,6 +113,8 @@ $crash_report_header .= "\nCrash report details:\n"; if(is_array($files_to_upload)) { $resp = upload_crash_report($files_to_upload); exec("rm /var/crash/*"); + // Erase the contents of the PHP error log + fclose(fopen("/tmp/PHP_errors.log", 'w')); echo "<p/>"; print_r($resp); echo "<p/><a href='/'>" . gettext("Continue") . "</a>" . gettext(" and delete crash report files from local disk."); @@ -124,6 +128,10 @@ $crash_report_header .= "\nCrash report details:\n"; } else { $crash_files = glob("/var/crash/*"); $crash_reports = $crash_report_header; + if (count($php_errors) > 0) { + $crash_reports .= "\nPHP Errors:\n"; + $crash_reports .= implode("\n", $php_errors) . "\n\n"; + } if(is_array($crash_files)) { foreach($crash_files as $cf) { if(filesize($cf) < FILE_SIZE) { diff --git a/usr/local/www/index.php b/usr/local/www/index.php index a2d8733..a59a652 100755 --- a/usr/local/www/index.php +++ b/usr/local/www/index.php @@ -60,7 +60,7 @@ if($g['disablecrashreporter'] != true) { // Check to see if we have a crash report $x = 0; if(file_exists("/tmp/PHP_errors.log")) { - $total = `/bin/cat /tmp/PHP_errors.log | /usr/bin/grep -vi warning | wc -l | awk '{ print $1 }'`; + $total = `/usr/bin/grep -vi warning /tmp/PHP_errors.log | /usr/bin/wc -l | /usr/bin/awk '{ print $1 }'`; if($total > 0) $x++; } |