Author Topic: undefined offset..  (Read 390 times)

0 Members and 1 Guest are viewing this topic.

Offline mkutche

  • Forecaster
  • *****
  • Posts: 1041
    • GosportWx.com
undefined offset..
« on: February 04, 2019, 07:17:43 AM »
any idea how to fix this??

Notice: Undefined offset: 1 in /home/hj2ke8lfpx43/public_html/forecast-summary.php on line 138

Notice: Undefined offset: 1 in /home/hj2ke8lfpx43/public_html/forecast-summary.php on line 140


here's line 138 and 140

 $discussion = $matches[1]; // now have the forecast as a string with \n delimiters

$discussion  = trim($matches[1]); // prevent extra white space at beginning and end

Thanks,
Mike
« Last Edit: February 04, 2019, 07:21:30 AM by mkutche »
Mike K.
Davis Vantage Vue 6250 - CumulusMX (3.21.1-b3205)
Gosport, Indiana
Gosportwx.com twitter.com/GosportINWX
-----------------------------------------------------------

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: undefined offset..
« Reply #1 on: February 04, 2019, 11:11:50 AM »
That undefined is caused by failure of the prior statement
Code: [Select]
preg_match('|<pre[^>]*>(.*)</pre>|Usi',$html,$matches);
It's likely due to an incomplete page fetch from the NWS site, so the area with a forecast discussion wasn't found.
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 mkutche

  • Forecaster
  • *****
  • Posts: 1041
    • GosportWx.com
Re: undefined offset..
« Reply #2 on: February 06, 2019, 10:47:05 AM »
That undefined is caused by failure of the prior statement
Code: [Select]
preg_match('|<pre[^>]*>(.*)</pre>|Usi',$html,$matches);
It's likely due to an incomplete page fetch from the NWS site, so the area with a forecast discussion wasn't found.

Can I hide the error??
Mike K.
Davis Vantage Vue 6250 - CumulusMX (3.21.1-b3205)
Gosport, Indiana
Gosportwx.com twitter.com/GosportINWX
-----------------------------------------------------------

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: undefined offset..
« Reply #3 on: February 06, 2019, 11:23:40 AM »
Sure.. best thing to do is to turn off Notice: errata from display.

In your php.ini just put:

error_reporting = E_ALL & ~E_NOTICE
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 mkutche

  • Forecaster
  • *****
  • Posts: 1041
    • GosportWx.com
Re: undefined offset..
« Reply #4 on: February 06, 2019, 09:08:22 PM »
Sure.. best thing to do is to turn off Notice: errata from display.

In your php.ini just put:

error_reporting = E_ALL & ~E_NOTICE

i put that and it still shows errors hm :(
Mike K.
Davis Vantage Vue 6250 - CumulusMX (3.21.1-b3205)
Gosport, Indiana
Gosportwx.com twitter.com/GosportINWX
-----------------------------------------------------------

 

anything