I keep getting this... Notice: Undefined variable: result in nws_weather_NDFDgenByDay() (line 355 of /Applications/MAMP/htdocs/mySite/sites/all/modules/nws_weather/nws_weather.module).

I double-checked the Lon/Lat to make sure they are correct. What am I missing?

I just discovered Drupal a week ago, and am really enjoying it, but I do hit a few snags in the new modules I've downloaded. Any hints would be greatly appreciated.

Thanks

Comments

dwaine’s picture

Assigned: Unassigned » dwaine
Category: support » bug

Hi,

It looks like you've exposed a bug. My first guess is that the lat/lon pair you've chosen has no data available. So the 'result' var ends up empty. It's an easy fix but won't be implimented until the next release. But you should be able to get the module to work when you choose a lat/lon pair that _does_ have data available. Generally, you will get data if you choose a populated part of the U.S. There are, of course, exceptions.

Can you tell me what lat/lon you've chosen so I can test and make sure my assumptions are correct.

Also, one more reminder. In the U.S., the longitude is always negative.

Thanks
Dwaine

titusbass’s picture

Hi Dwaine,
Thanks for the quick response. My coordinates for Three Forks, MT are 45.91, -111.43
http://forecast.weather.gov/MapClick.php?CityName=Three+Forks&state=MT&s...

I even tried Bozeman, MT 45.68, -111.05
http://forecast.weather.gov/MapClick.php?CityName=Bozeman&state=MT&site=...

And... even Los Angeles, CA 34.06, -118.36..

I still got the same "Undefined variable" for all three. I also have SOAP enabled. If that helps.

I think it's a great module and hope to get it working. Thanks for your time in developing it it. I appreciate it.

dwaine’s picture

Hi Titusbass,

As I mentioned earlier, the PHP Notice you are receiving is a bug in the code exposed when the SOAP call returns no data. I've verified that the lat/lon pairs you are trying _do_ have data.

Basically, I don't know why you are getting these Notices. But here are a couple things to check.

Another scenario that could cause this is lack of connectivity to the SOAP server. On my local development machine I disabled the network connection and received the same notice. I assume you have general access to the Internet. But maybe you have a firewall that is blocking SOAP connections? Obviously, getting your firewall configured to enable SOAP connections is something that I won't be able to help with.

You mentioned that SOAP was installed. I would recommend looking here to verify that it is enabled in your Apache environment:
/admin/reports/status/php
This is a web version of phpinfo() and should show a section titled 'Soap' with a setting of 'Soap Client' that needs to be 'enabled'.

The last hope is a modification to my code that is on the 'Todo' list. Basically, I'm hoping to add code to nws_weather that not only catches the Notice you are receiving, but also retrieves additional detail about the cause of the Notice. This won't necessarily make the module work for you, but might give information about what portion of the mechanism is failing.

Thanks
Dwaine

dwaine’s picture

Status: Active » Closed (fixed)