dg9vh / YSFReflector-Dashboard

Dashboard for YSFReflector (by G4KLX)
Creative Commons Zero v1.0 Universal
35 stars 37 forks source link

Apache2 Log: A non well formed numeric value #29

Closed RookieMorph closed 1 year ago

RookieMorph commented 3 years ago

Apache2 error.log shows following issue:

[php7:notice] [pid 9903] [client 94.31.97.134:58201] PHP Notice: A non well formed numeric value encountered in /var/www/html/ysf-1/include/sysinfo.php on line 96.......

But the value for Idle seems to be ok in the dashboard.

My System: RPI with Debian Buster and PHP7, using latest version of the Dashboard.

My workarround (quick and dirty): Change line 96 in sysinfo.php

$idletime = format_time((substr($output,strpos($output," ")))/$cpucores);

to

$idletime = 4;

Fault in log was gone, but wrong value now for Idle.

Update after upgrading to PHP7.3: Logfile shows another issue: [php7:warn] [pid 9438] [client 94.31.97.134:62851] PHP Warning: Use of undefined constant DISTRIBUTION - assumed 'DISTRIBUTION' (this will throw an Error in a future version of PHP) in /var/www/html/ysf-1/include/tools.php on line 69,

nr0dham commented 3 years ago

I'm just getting started here, but I figured the numeric issue out at least. There are trailing spaces in two places, and surrounding them with a call to trim() fixes it. The first, line 92, put a trim around $output. The second, the substr call in line 96 returns a trailing space, so put a trim() around that, and the error goes away.

I'm also seeing the DISTRIBUTION error, working on figuring that one out still.

I hope someone can do a pull request, I'm still figuring all of that out. 73!

RookieMorph commented 3 years ago

Did a pull request. Tryed it out today, found the following in the Apache Log:

[Fri May 21 13:42:07.549933 2021] [php7:warn] [pid 29509] [client 192.168.2.128:60969] PHP Warning: Use of undefined constant DISTRIBUTION - assumed 'DISTRIBUTION' (this will throw an Error in a future version of PHP) in /var/www/html/ysf/include/tools.php on line 69, referer: http://44.225.66.200/ysf/

[Fri May 21 13:42:08.624282 2021] [php7:notice] [pid 29509] [client 192.168.2.128:60969] PHP Notice: A non well formed numeric value encountered in /var/www/html/ysf/include/sysinfo.php on line 96, referer: http://44.225.66.200/ysf/

dg9vh commented 3 years ago

Currently in Hospital, will check, when back healthy again.

RookieMorph commented 3 years ago

Autsch, hopefully nothing too bad...get well soon!