Author Topic: php 8.2 error  (Read 870 times)

0 Members and 1 Guest are viewing this topic.

Offline Johnmac

  • Senior Contributor
  • ****
  • Posts: 170
    • Westminster Massachusetts Weather
php 8.2 error
« on: February 26, 2023, 07:53:23 PM »
I have updated to php 8.2 and apparently have not done it properly or have missed something -

1. updated the Saratoga template files
2. updated ajax-dashboard6.php to v6.95h and ajaxWD3.js
3. updated some of the legacy scripts.

It appears I have missed something and messed up the index.php page.

Looking for any assistance that will get me back on track.

Error message on loading index.php -

Fatal error: Uncaught Error: Undefined constant "month" in /home4/scannor1/public_html/AltAjaxDashboardConfig6.php:187 Stack trace: #0 /home4/scannor1/public_html/ajax-dashboard6.php(109): include_once() #1 /home4/scannor1/public_html/index.php(97): include_once('/home4/scannor1...') #2 {main} thrown in /home4/scannor1/public_html/AltAjaxDashboardConfig6.php on line 187

Website - scannorthcounty.net

Thanks,

John

John
Westminster, MA USA

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: php 8.2 error
« Reply #1 on: February 26, 2023, 08:08:02 PM »
Old versions of AltAjaxDashboardConfig6.php had 'naked' constants which prior versions of PHP treated as literal strings.
They now have to be in single or double quotes.

Change
Code: [Select]
$today = getdate();
$month = $today[month];
$day = $today[mday];
to
Code: [Select]
$today = getdate();
$month = $today["month"];
$day = $today["mday"];
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Johnmac

  • Senior Contributor
  • ****
  • Posts: 170
    • Westminster Massachusetts Weather
Re: php 8.2 error
« Reply #2 on: February 26, 2023, 08:58:59 PM »
Ken - That populated the page with some data, but now have the following errors -

Warning: A non-numeric value encountered in /home4/scannor1/public_html/ajax-dashboard6.php on line 548

Warning: A non-numeric value encountered in /home4/scannor1/public_html/ajax-dashboard6.php on line 549

Warning: Undefined variable $rtemp in /home4/scannor1/public_html/ajax-dashboard6.php on line 3072

Warning: Undefined variable $rtfdate in /home4/scannor1/public_html/ajax-dashboard6.php on line 3072
 


As seen at scannorthcounty.net

I looked at those lines, but does not to be anything related to those errors.

John
John
Westminster, MA USA

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: php 8.2 error
« Reply #3 on: February 26, 2023, 09:19:39 PM »
You have Weather-Display set to include units in the measurements and that's the root cause of the non-numeric errors (which then cause the undefined variable errors).

Use WD, Control Panel, Web Files/Web Page, Custom Web setup TAB
Untick : include the Units used

My stock dashboard processed testtags.php with/without units.  The alternative dashboard still has come code where NOT having the units included is important (and you discovered one of those instances).
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Johnmac

  • Senior Contributor
  • ****
  • Posts: 170
    • Westminster Massachusetts Weather
Re: php 8.2 error
« Reply #4 on: February 26, 2023, 09:39:08 PM »
Thanks Ken, that did the trick. Back in business.

John
John
Westminster, MA USA

Offline andro700

  • Chuck
  • Forecaster
  • *****
  • Posts: 420
    • Gobles Weather Page
Re: php 8.2 error
« Reply #5 on: February 28, 2023, 02:06:04 PM »
For some reason my last hour dewpoint shows in the negative.
https://www.goblesweather.com/index.php

Chuck

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: php 8.2 error
« Reply #6 on: March 01, 2023, 01:40:03 PM »
duplicate posting.. I replied in the first instance of this problem post.  It's not an 8.2 PHP issue, it's a JavaScript issue with ajaxWDwx3.js.  I'm working on it (and other issues with the JavaScript).
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

 

anything