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

0 Members and 1 Guest are viewing this topic.

Offline mkutche

  • Forecaster
  • *****
  • Posts: 859
    • 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.
WS2080 - Cumulus MX b3043
Gosport, Indiana
Gosportwx.com Gosportwx.com/PWS/ Gosportwx.com/j-template/ twitter.com/GosportINWX facebook.com/GosportINWX
-----------------------------------------------------------

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7399
  • 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, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline mkutche

  • Forecaster
  • *****
  • Posts: 859
    • 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.
WS2080 - Cumulus MX b3043
Gosport, Indiana
Gosportwx.com Gosportwx.com/PWS/ Gosportwx.com/j-template/ twitter.com/GosportINWX facebook.com/GosportINWX
-----------------------------------------------------------

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7399
  • 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, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline mkutche

  • Forecaster
  • *****
  • Posts: 859
    • 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.
WS2080 - Cumulus MX b3043
Gosport, Indiana
Gosportwx.com Gosportwx.com/PWS/ Gosportwx.com/j-template/ twitter.com/GosportINWX facebook.com/GosportINWX
-----------------------------------------------------------

 

anything