Page 1 of 1

PHP 8.1 fixes for Saratoga templates...

Posted: Wed 19 Jan 2022 12:31 am
by saratogaWX
I'd just gotten to install PHP8.1 and found some new Deprecated errata in the Base template set.

Mainly, the default casting of a float to an integer now gives a Deprecated message so things like

Code: Select all

$dir = $windlabel[ fmod((($winddir + 11) / 22.5),16) ];
had to change to

Code: Select all

$dir = $windlabel[ (integer)fmod((($winddir + 11) / 22.5),16) ];
to quiet the messages.

Also, the

Code: Select all

$minutes = intval(($sec / 60) % 60);
was changed to

Code: Select all

$minutes = intval(fmod($sec / 60, 60));
In the GD library, the imagepolygon() and imagefilledpolygon() went from 4 arguments to 3 (losing the $num_args entry).

So.. I've been working on the Base-USA, CU-plugin site and will work on the Canada and World sites shortly.
I've updated the distributions with the following fixes:

Version 3.347 - 18-Jan-2022 (Base-*) PHP 8.1 updates to fix Deprecated errata: get-USNO-sunmoon.php V3.04, include-wxstatus.php V1.13, thermometer.php V1.18;
(Base-USA) advforecast2.php V5.18, NWS-regional-radar-animate.php V1.04, radar-status.php V1.18;
(CU-Plugin) PHP8.1 updates to fix Deprecated errata and add new CumulusMX data variables: CU-defs.php V1.12

Use the update tool with your Base and Plugin for 18-Jan-2022

I've attached a text file showing the main diffs of old/new files.

p.s. -- PHP 8.1 also announced the Deprecation of strftime()/strptime() built-in's ..the mesonet-map, global-map use that (and likely others too).

Re: PHP 8.1 fixes for Saratoga templates...

Posted: Fri 21 Jan 2022 10:44 pm
by ConligWX
Thanks for this Ken,

Am thinking of moving to PHP 8.x very soon.
mcrossley wrote:
- are the default CumulusMX Templates php 8.x compatible?