Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PHP error without warning when logging is enabled - SOLVED
05-11-2022, 06:34 AM,
#7
RE: Failure on PHP v8 appears to prevent deleting user
Hi TuroboPT, unfortunately still no warning message when attempting to delete user having audit trail entries with log severity level set to "All", and still have an error in the Apache httpd log file. However, the error has changed from "Argument #1 ($stream) must be of type resource, null given..." to "... must be of type resource, bool given..."

Edited includes/footer.php as requested (using tabs as original file uses tabs):


Code:
dale@whizzer:/usr/local/www/weberp % head -n 20 includes/footer.php
<?php
echo '<div id="mask">
                <div id="dialog"></div>
        </div>';

if (isset($Messages) and count($Messages) > 0) {

        if (isset($_SESSION['LogSeverity']) and $_SESSION['LogSeverity'] > 0) { // open log file if needed
                $LogFile = fopen($_SESSION['LogPath'] . '/weberp.log', 'a');
        }

        foreach ($Messages as $Message) {
                switch ($Message[1]) {
                        case 'error':
                                $Class = 'error';
                                $Message[2] = $Message[2] ? $Message[2] : _('ERROR') . ' ' . _('Report');
                                if (isset($_SESSION['LogSeverity']) and $_SESSION['LogSeverity'] > 3) {
                                        fwrite($LogFile, date('Y-m-d h-m-s') . ',' . $Type . ',' . $_SESSION['UserID'] . ',' . trim($Msg, ',') . "\n");
                                }
                        break;
dale@whizzer:/usr/local/www/weberp %

Error message in Apache log file:

Code:
dale@whizzer:/usr/local/www/weberp % tail -n 1 /var/log/httpd-error.log
[Tue May 10 14:25:41.638036 2022] [php:error] [pid 51945] [client 162.223.103.50:19623] PHP Fatal error:  Uncaught TypeError: fwrite(): Argument #1 ($stream) must be of type resource, bool given in /usr/local/www/weberp/includes/footer.php:26\nStack trace:\n#0 /usr/local/www/weberp/includes/footer.php(26): fwrite()\n#1 /usr/local/www/weberp/WWW_Users.php(842): include('...')\n#2 {main}\n  thrown in /usr/local/www/weberp/includes/footer.php on line 26, referer: https://weberp.dalescott.net/WWW_Users.php
dale@whizzer:/usr/local/www/weberp %
http://www.dalescott.net
Reply


Messages In This Thread
RE: Failure on PHP v8 appears to prevent deleting user - by dalescott - 05-11-2022, 06:34 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)