Author Topic: PHP 8.1 fixes for Saratoga templates...  (Read 1352 times)

saratogaWX

  • Strong Breeze
  • ***
  • Posts: 156
  • Weather website programming enthusiast
    • Saratoga-Weather.org
  • Station Details: Davis VP1 +, iMAC 21, OSX 10.6.8
PHP 8.1 fixes for Saratoga templates...
« on: January 19, 2022, 12:32:56 AM »
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]
$dir = $windlabel[ fmod((($winddir + 11) / 22.5),16) ]; had to change to
Code: [Select]
$dir = $windlabel[ (integer)fmod((($winddir + 11) / 22.5),16) ]; to quiet the messages.

Also, the
Code: [Select]
$minutes = intval(($sec / 60) % 60); was changed to
Code: [Select]
$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).
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis Vantage Pro Plus - FARS, Boltek-PCI/NexStorm, GRLevel3, WD, WL, VWS, Cumulus, Meteohub, WeatherSnoop, WeatherCat
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Blicj11

  • Storm
  • *****
  • Posts: 3969
    • EW3808
    • KUTHEBER6
    • Timber Lakes Weather
  • Station Details: Davis Vantage Pro2 Plus | WeatherLinkIP Data Logger | iMac (2019), 3.6 GHz Intel Core i9, 40 GB RAM, macOS Ventura 13.6.7 | Sharx SCNC2900 Webcam | WeatherCat 3.3 | Supportive Wife
Re: PHP 8.1 fixes for Saratoga templates...
« Reply #1 on: January 20, 2022, 08:16:26 PM »
Thanks for your support for WeatherCat in your template.
Blick