PHP8 issue **Solved**

I’m just trying to update to PHP8 and came across this error.

Fatal error: Uncaught TypeError: round(): Argument #1 ($num) must be of type int|float, string given in /home/loganvil/public_html/wsfct4/wsIncWxsimPCreate.php:207 Stack trace: #0 /home/loganvil/public_html/wsfct4/wsIncWxsimPCreate.php(207): round(‘’) #1 /home/loganvil/public_html/wsfct4/wsIncWxsimPHtml4.php(85): include_once(‘/home/loganvil/…’) #2 /home/loganvil/public_html/wsfct4/wsFctWxsimDPage.php(270): include_once(‘/home/loganvil/…’) #3 {main} thrown in /home/loganvil/public_html/wsfct4/wsIncWxsimPCreate.php on line 207

When I change back to PHP7.4 on my website, it works as expected.

Anyone come across this and know what the fix it ?

Thanks.

Without seeing the actual code it is difficult to know. What I would say is that PHP 8 does change quite a lot of stuff which causes errors in older code written for earlier releases. Who is the author of said PHP code? Could they help? The error says it is a rounding error where the variable is not an integer or float number but a string.

Stuart

I believe the author is no longer a member of this forum, wvdkuil was the username here, but only shows up as Guest here.

It was the Leuven WXSIM scripts.

wdvkuil is now pwsdashboard but he’s no longer supporting the WxSim (and other) standalone forecast display scripts.

Suggest you read this WXSIM "EWN-style" for php8 if you trying to use the ENW style but the old leuven template is end of life and no longer supported

The Leuven forecast scripts are fully compatible with PHP8.1. Check here: Leuven v4.13 forecast scripts 2024-06-22 PHP 8.2 - HighCharts 11.3.0
All supporting users have downloaded this version already last year.

If there is a PHP 9.x problem in my lifetime, I will adapt, test and make the changes available to my supporting users.

Wim

Verstuurd vanaf mijn iPad

I obviously misunderstood what I read.

I downloaded an older version of the scripts a while ago and started to experiment with them on my web site, but as usual my own web site comes last to be worked on after the forum, WxSim, etc and I didn’t complete my testing. I went back to try to download a newer version just recently and found on the download page

Sorry for the inconvenience. No downloads possible. Sites are closing down
which gave the impression that you’d stopped supporting them. I did follow the link to the support page but that only references PWS Dashboard which again gave the impression that you were no longer supporting the forecast scripts.

Can you please clarify the situation. You provide support for existing users who have made a donation in the past but there is now no way to join the list of ‘supporting users’ because the scripts can’t be downloaded for testing by new users?

Note: I’m not having a go at you about this…I just want to know whether I (and others in future) have missed the boat to use the scripts? If that’s your decision then I respect it. It’s your software to do with as you wish. At least if I know that then I can look around for some other software that I can use instead.

I try to explain my ideas about supporting these old scripts.

EndOfLife =>

  1. The contents of the Leuven forecast scripts V4 package is becoming smaller and smaller.
    Multiple forecast companies dropped the API’s or changed them heavily in the past. For example: NOAA, YR.no, WeatherUnderground in the past years and March 31 DarkSky
    NWS/NOAA SOAP becomes often less stable for days.
  2. The design of the scripts is “not up-to-date” to say the least.
  3. There are good alternatives f.i. EWN has multiple more modern looking general forecast and also two WXSIM forecasts.

Support => continuous support for existing users / sponsors
They invested their time to implement and install the scripts in their website a long time ago. Does not cost that much time from me to help if there is a problem with PHP

In the first releases up to ten years ago, new users needed one good forecast and integrated that on their website.
They spent a lot of time to build their website and were willing to study the readme and follow the instructions.

The quality, readme files a.s.o. of the old scripts compares bad with the app-experience younger users have.
Nowadays one wants / uses multiple different forecasts, just for the fun of it.
One does not read the documentation, one asks questions over and over again, one expects scripts to run “out-of-the-box” and there should be a graphical install procedure.

New users: Supporting new users with these old scripts cost more support time which often is not available.

My conclusions:
I feel obliged to users who supported in the past.
I will not enhance or write new scripts. Only adept the current scripts with the current API’s for future PHP-changes.
I don’t want any obligations to unknown “maybe i will use your product but . . .” users
And to really write a new set of forecasts with “modern” app-type setup instructions, would cost far too much time.

Downloads:
They are available again by pressing the button. Support will be sparse.

Regards to all,

Wim

Have downloaded your updates, and all is good again with my site.

Thanks for such a great script.

Just downloaded the Leuven v4.11 forecast scripts 2022-03-27 PHP 8.1.1 scripts and loaded them onto my system. Did a little customizing and they displayed correctly. I then updated wsFctWxsimDPage.php by changing $your_settings from ‘_metric_settings.php’ to ‘_us_settings.php’. I uploaded this file then again tested wsFctWxsimDPage.php. This time, instead of the graph at the top of the page, there is now a message where the graph should be “here the graph will be drawn”. If I change $your_settings back to ‘metric’, the graph displays again. If I go back to the ‘us’ setting, I get the error message again. I’m using the original copy of '_us_settings.php without any changes. Any idea what’s going on? The URL is wxsimD weather forecast. Thanks.

Hi SteveFitz1,

First thought:
This is not a PHP8.x problem.
It is caused by a new improved release 11.0.0 on November 26 of the dynamically loaded Highcharts graphing javascripts

A temporary answer is found in the support topic for Leuven scripts

I will update and test the scripts a.s.a.p. and publish the new zip.

Second thought:
The WXSIM scripts are already compliant with release Highcharts 11.0.0
Your problem is in the settings.
Please test the tabs below the graph
Only tab “Forecast” is OK
Tab icons has unrealistic temperatures 138.2° and wind-speeds 7.4565 mph
The two forecast tabs are empty.

Your ../plaintext.txt is OK
Your ../latest.csv is very old

Year ,Month ,Day ,Time ,WX Type 1 ,WX Type 2 ,Temperature 
  ,  ,  ,hrs , , ,deg F ,deg F ,deg F ,pct ,deg F ,deg F , 
 2016  , 3  , 5  , 8  ,CLEAR      ,MOD. DEW , 48.5  , 48.5
2016  , 3  , 5  , 8.5  ,CLEAR      , , 51.1  , 51  , 49.8

As that .csv data is used for graphs and the empty tabs it is a data-problem not a script problem.

Succes,
Wim van der Kuil
Leuven scripts Sponsors

Wim,

Thanks very much for the information. As you pointed out, the problem was the latest.csv. I actually upload my “good” latest.csv to a folder called wxsimcsv. I made that update in my script to point to that folder for latest.csv and that fixed my issue.

Thanks again for your assistance.

Steve