Author Topic: Deciphering Error File  (Read 333 times)

0 Members and 1 Guest are viewing this topic.

Offline rlee171

  • Contributor
  • ***
  • Posts: 116
    • Peaceful Hills Weather
Deciphering Error File
« on: March 16, 2021, 12:57:42 PM »
I have a problem with my Cumulus Graphs updating, original topic https://www.wxforum.net/index.php?topic=41704.0. I am continuing my issue here because it is not related to Cumulus (Cumulus is updating properly). It finally dawned on me to look at my error logs. There are a host of errors but I am going to post a few that may or may not be related to my graphs not updating, but primaily as an example of how I do not understand how the error log functions. I believe it is my lack of understanding how the errors are generated. Possibly someone can explain to me how the errors process works, in other words, when a script is running and has an issue it reports that to the error file. The reason I am asking is when I look at the specific line # in the .php file referenced I don't see a problem, hence it is not the specific line in the code but when the code is executed. I am posting an example of some errors and then those error lines in the file referenced. I cannot see the error. This is all as clear as mud to me. Would someone explain how to decipher an error in the log file so I can use that information to actually attempt to find the problem.

Thanks in advance.

Error file:
 [ You are not allowed to view attachments ]

/wxwugraphs/WUG-settings.php:
 [ You are not allowed to view attachments ]
 [ You are not allowed to view attachments ]
 [ You are not allowed to view attachments ]

WU-History-inc.php:
 [ You are not allowed to view attachments ]

Edit: The above example is not related to my wxcugraphs not updating, but more of a general question about how to use our error file to help understand where the problem actually exists.


« Last Edit: March 16, 2021, 01:17:13 PM by rlee171 »
Davis VP2 
Blitzortung Stations: 1387  1445  2315
CWOP: EW1823
CoCoRaHS: AR-GL-29
WU: KARHOTSP16
Cumulus
GRLevel3

hsnpar.com

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8387
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Deciphering Error File
« Reply #1 on: March 16, 2021, 01:36:06 PM »
Getting old code to behave can be a challenge.   Here's some thoughts about the specific errata you cited:

1) for "Undefined variable/index" errors, add a check to see if it is defined before using it.

Example:  instead of

if ($_GET['lang']) {

use

if (isset($_GET['lang']) ) {

and for the other one cited:

if ($_GET['i'] != '1' && $thisPag == 'graph') {

use

if (isset($_GET['i']) && $_GET['i'] != '1' && $thisPag == 'graph') {

For the non well-formed numeric value error, somewhere in the code the AddDate() function is being called with one of the variables ($month,$day,$year,$numdays) not having a number in it.  That will have to be chased down in the code.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8387
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Deciphering Error File
« Reply #2 on: March 16, 2021, 02:18:04 PM »
In a browser, you can enable the Developer Tools, and it can show lots of information to you.  It won't display PHP errors per se..those are only in the error_logs on the server (and depending on your PHP settings, appear inline on the HTML page in the browser).
You can use the Developer Tools in the browser to spot missing images/css/js files (404s), and do some debugging with the page's CSS and JS.

In Firefox, enable the tools via CTRL-SHIFT-K (or menu Tools, Web Developer, Web Console).
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline rlee171

  • Contributor
  • ***
  • Posts: 116
    • Peaceful Hills Weather
Re: Deciphering Error File
« Reply #3 on: March 16, 2021, 03:07:07 PM »
Ok..  I will use those 'tools'

One more question about your original response.
Quote
For the non well-formed numeric value error, somewhere in the code the AddDate() function is being called with one of the variables ($month,$day,$year,$numdays) not having a number in it.  That will have to be chased down in the code.



 [ You are not allowed to view attachments ]

 [ You are not allowed to view attachments ]
« Last Edit: March 17, 2021, 10:50:50 PM by rlee171 »
Davis VP2 
Blitzortung Stations: 1387  1445  2315
CWOP: EW1823
CoCoRaHS: AR-GL-29
WU: KARHOTSP16
Cumulus
GRLevel3

hsnpar.com

Offline rlee171

  • Contributor
  • ***
  • Posts: 116
    • Peaceful Hills Weather
Re: Deciphering Error File
« Reply #4 on: March 16, 2021, 11:35:23 PM »
I have scoured the script at least a dozen times and the following are all I can find relating to AddDate...   Unfortunately I wouldn't be able to tell if something is wrong with them or not.

Searching for problem as suggested, error added towards end

In Settings:
$Ltarget   = array("Day", "Week", "Month", "Year");

In Script:
if ($mode == 1) {
   $ndate = AddDate($mo, $da, $yr, -1);
   echo '<td class="nobr noprint"><!-- a href="' . $_SERVER['PHP_SELF'] . '?ID=' . $WUID . '&amp;month=' . $ndate['mon'] . '&amp;day=' . $ndate['mday'] . '&amp;year=' . $ndate['year'] . '&amp;units=' . $units . '&amp;mode=' . $mode . '">&laquo; ' . $Lprev . ' ' . $Ltarget[0] . '</a --></td>';
} elseif ($mode == 2) {
   $ndate = AddDate($mo, $da, $yr, -7);
   echo '<td class="nobr noprint"><!-- a href="' . $_SERVER['PHP_SELF'] . '?ID=' . $WUID . '&amp;month=' . $ndate['mon'] . '&amp;day=' . $ndate['mday'] . '&amp;year=' . $ndate['year'] . '&amp;units=' . $units . '&amp;mode=' . $mode  . '">&laquo; ' . $Lprev . ' ' . $Ltarget[1] . '</a --></td>';
} elseif ($mode == 3) {
   $ndate = AddDate($mo, $da, $yr, -30);
   echo '<td class="nobr noprint"><!-- a href="' . $_SERVER['PHP_SELF'] . '?ID=' . $WUID . '&amp;month=' . $ndate['mon'] . '&amp;day=' . $ndate['mday'] . '&amp;year=' . $ndate['year'] . '&amp;units=' . $units . '&amp;mode=' . $mode  . '">&laquo; ' . $Lprev . ' ' . $Ltarget[2] . '</a --></td>';
} elseif ($mode == 4) {
   $ndate = AddDate($mo, $da, $yr, -365);
   echo '<td class="nobr noprint"><!-- a href="' . $_SERVER['PHP_SELF'] . '?ID=' . $WUID . '&amp;month=' . $ndate['mon'] . '&amp;day=' . $ndate['mday'] . '&amp;year=' . $ndate['year'] . '&amp;units=' . $units . '&amp;mode=' . $mode  . '">&laquo; ' . $Lprev . ' ' . $Ltarget[3] . '</a --></td>';
}      


if ($mode == 1) {
   $ndate = AddDate($mo, $da, $yr, +1);
   echo '<td class="nobr noprint"><!-- a href="' . $_SERVER['PHP_SELF'] . '?ID=' . $WUID . '&amp;month=' . $ndate['mon'] . '&amp;day=' . $ndate['mday'] . '&amp;year=' . $ndate['year'] . '&amp;units=' . $units . '&amp;mode=' . $mode . '">' . $Lnext . ' ' . $Ltarget[0] . ' &raquo;</a --></td>';
} elseif ($mode == 2) {
   $ndate = AddDate($mo, $da, $yr, +7);
   echo '<td class="nobr noprint"><!-- a href="' . $_SERVER['PHP_SELF'] . '?ID=' . $WUID . '&amp;month=' . $ndate['mon'] . '&amp;day=' . $ndate['mday'] . '&amp;year=' . $ndate['year'] . '&amp;units=' . $units . '&amp;mode=' . $mode  . '">' . $Lnext . ' ' . $Ltarget[1] . ' &raquo;</a --></td>';
} elseif ($mode == 3) {
   $ndate = AddDate($mo, $da, $yr, +30);
   echo '<td class="nobr noprint"><!-- a href="' . $_SERVER['PHP_SELF'] . '?ID=' . $WUID . '&amp;month=' . $ndate['mon'] . '&amp;day=' . $ndate['mday'] . '&amp;year=' . $ndate['year'] . '&amp;units=' . $units . '&amp;mode=' . $mode  . '">' . $Lnext . ' ' . $Ltarget[2] . ' &raquo;</a --></td>';
} elseif ($mode == 4) {
   $ndate = AddDate($mo, $da, $yr, +365);
   echo '<td class="nobr noprint"><!-- a href="' . $_SERVER['PHP_SELF'] . '?ID=' . $WUID . '&amp;month=' . $ndate['mon'] . '&amp;day=' . $ndate['mday'] . '&amp;year=' . $ndate['year'] . '&amp;units=' . $units . '&amp;mode=' . $mode  . '">' . $Lnext . ' ' . $Ltarget[3] . ' &raquo;</a --></td>';
}   

// End of the script all functions follow   

Function with error

function AddDate ( $month, $day, $year, $numdays) {
   $nday = $day + $numdays;
   $newdate = mktime (0,0,0,$month,$nday,$year);      (line 1431 in error list shown above)
   return getdate($newdate);
}   
/*   Returns Array (
    [seconds] => 40
    [minutes] => 58
    [hours]   => 21
    [mday]    => 17
    [wday]    => 2
    [mon]     => 6
    [year]    => 2003
    [yday]    => 167
    [weekday] => Tuesday
    [month]   => June
   
  •        => 1055901520*/

   
« Last Edit: March 17, 2021, 10:46:59 PM by rlee171 »
Davis VP2 
Blitzortung Stations: 1387  1445  2315
CWOP: EW1823
CoCoRaHS: AR-GL-29
WU: KARHOTSP16
Cumulus
GRLevel3

hsnpar.com

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8387
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Deciphering Error File
« Reply #5 on: March 22, 2021, 02:00:36 PM »
I just released an update to WU-History-inc.php (V3.4h - 21-Mar-2021) that fixes that problem.

Download from https://github.com/ktrue/WU-history or from https://saratoga-weather.org/WU-History-inc.php?sce=view
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

 

anything