Web Weather > Weather Website PHP/AJAX scripting
Forecast-compare script and PHP 8?
(1/1)
RickNY:
I'been using jmcmurry's WXSIM forecast-compare script for a while... Figured I would try to start sorting out PHP 8 issues since I'm on 7.4... I did run into some with PHP 8, I was just wondering if there are some known issues with this script?
I did have to clear my existing data for forecast results because I was using an older version that didn't use abbreviations for the special characters, and I thought that may have been my issue.
I guess I should wait until my cron jobs start populating the log files a bit -- but wanted to check if maybe I did something wrong on my end.
Thanks
Rick
RickNY:
OK, I probably have to wait until I fill up more data again in my forecast logs again -- but so far I was able to correct things by changing:
--- Code: ---if (count($deltas[$i])
--- End code ---
to
--- Code: ---if (count((array)$deltas[$i])
--- End code ---
on Lines 798, 850, and 903 of forecast-compare-include.php
RickNY:
Another change I needed to make with PHP 8.1.5 to get my logs to start working. Was receiving this error when forecast-compare-include.php fired:
--- Code: ---Fatal error</b>: Uncaught TypeError: date(): Argument #2 ($timestamp) must be of type ?int, string given in /home/indigopc/public_html/forecast-compare-include.php:254
--- End code ---
Changed Line 254 from:
--- Code: ---if ($WSUpdate == date($mask,$entry[0])) { // then we have an entry for that day
--- End code ---
to
--- Code: ---if ($WSUpdate == date($mask,(int)$entry[0])) { // then we have an entry for that day
--- End code ---
RickNY:
Some more changes related to date() -- I think this should be all of them:
Line 370:
--- Code: ---$fday = date("m/d/Y",$entry[0]); // ** Do not change this!!! ** - it is just to determine day/night
--- End code ---
to
--- Code: ---$fday = date("m/d/Y",(int)$entry[0]); // ** Do not change this!!! ** - it is just to determine day/night
--- End code ---
Line 454:
--- Code: ---<td><?php echo $Langupdated . date($FCdatestr,$entry[0]) . $Langat . date($FCtimestr,$entry[0]); ?> </td>
--- End code ---
to
--- Code: ---<td><?php echo $Langupdated . date($FCdatestr,$(int)entry[0]) . $Langat . date($FCtimestr,(int)$entry[0]); ?> </td>
--- End code ---
Line 532:
--- Code: ---echo date($FCdatestr,$entry[0]);
--- End code ---
to
--- Code: ---echo date($FCdatestr,(int)$entry[0]);
--- End code ---
Line 534:
--- Code: ---echo "<br />" . date($FCtimestr,$entry[0]);
--- End code ---
to
--- Code: ---echo "<br />" . date($FCtimestr,(int)$entry[0]);
--- End code ---
Line 957:
--- Code: ---echo '>' . date($FCdatestr,$entry[0]) . '</option>' . "\n";
--- End code ---
to
--- Code: ---echo '>' . date($FCdatestr,(int)$entry[0]) . '</option>' . "\n";
--- End code ---
Navigation
[0] Message Index
Go to full version