WXforum.net
Web Weather => Weather Website PHP/AJAX scripting => Topic started by: RickNY on April 28, 2022, 04:50:16 PM
-
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
-
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:
if (count($deltas[$i])
to
if (count((array)$deltas[$i])
on Lines 798, 850, and 903 of forecast-compare-include.php
-
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:
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
Changed Line 254 from:
if ($WSUpdate == date($mask,$entry[0])) { // then we have an entry for that day
to
if ($WSUpdate == date($mask,(int)$entry[0])) { // then we have an entry for that day
-
Some more changes related to date() -- I think this should be all of them:
Line 370:
$fday = date("m/d/Y",$entry[0]); // ** Do not change this!!! ** - it is just to determine day/night
to
$fday = date("m/d/Y",(int)$entry[0]); // ** Do not change this!!! ** - it is just to determine day/night
Line 454:
<td><?php echo $Langupdated . date($FCdatestr,$entry[0]) . $Langat . date($FCtimestr,$entry[0]); ?> </td>
to
<td><?php echo $Langupdated . date($FCdatestr,$(int)entry[0]) . $Langat . date($FCtimestr,(int)$entry[0]); ?> </td>
Line 532:
echo date($FCdatestr,$entry[0]);
to
echo date($FCdatestr,(int)$entry[0]);
Line 534:
echo "<br />" . date($FCtimestr,$entry[0]);
to
echo "<br />" . date($FCtimestr,(int)$entry[0]);
Line 957:
echo '>' . date($FCdatestr,$entry[0]) . '</option>' . "\n";
to
echo '>' . date($FCdatestr,(int)$entry[0]) . '</option>' . "\n";