-
-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid argument supplied for foreach() in WeatherForecast.php on line 85 #100
Comments
Hey @DacotahHarvey
Sounds like it could be true. The OpenWeatherMap API does also sorts of crazy things 😕
Maybe, I don't know, to be honest.
It'd be great if you could provide the data OpenWeatherMap returns when such an error occurs. Please try logging the $url and result here: https://github.com/cmfcmf/OpenWeatherMap-PHP-Api/blob/v2.1.2/Cmfcmf/OpenWeatherMap.php#L393-L395 The correct fix most likely depends on the data the API returns on these failed requests. |
Hey @cmfcmf, Thanks for the reply. It might take me a day or two to have the time to do this, so I will let you know when I have the information. I am also going to reach out to OpenWeatherMap and see if they can provide any more information. Talk soon, |
Hey @cmfcmf, I put in the required checks to log the calls from OpenWeatherMap but the issue doesn't seem to be happening anymore. I am going to chalk it up to a period of bad data from the API. Would you like me to close the issue? Thanks for your help! |
Hi @DacotahHarvey, I think this warning message about the Thanks. |
Hey @peter279k, Yes I can! Unfortunately it has been working perfectly again. Those two days seem to be the only times that something was acting up. I will update this if I ever get another response with bad data :) Thanks! |
I'm going to close this for now. Feel free to comment as soon as you experience these problems again! Will keep this in mind for version 3 (#72). |
@cmfcmf Thank you very much! I appreciate the consideration. I am glad this kind of fizzled out and resolved itself for the time being. Thanks to both of you! |
Hello!
This issue has randomly started popping up on our website starting yesterday (February 7th)
I'm not entirely sure what the issue is, although my assumption is that OpenWeatherMap is returning some invalid data and the Constructor is trying to access something that doesn't exist.
Could this be caused by us going over our Rate Limits?
I am looking for a quick solution that we can apply as it is happening in both our test environment and on our Production environment.
Thank you for any help you can provide!
Full error message provided:
Warning: Invalid argument supplied for foreach() in /ourProject/lib/cmfcmf/openweathermap-php-api/Cmfcmf/OpenWeatherMap/WeatherForecast.php on line 85
Link to the line in question:
https://github.com/cmfcmf/OpenWeatherMap-PHP-Api/blob/master/Cmfcmf/OpenWeatherMap/WeatherForecast.php#L85
The text was updated successfully, but these errors were encountered: