getValue() error
KarelWintersky opened this issue · 7 comments
Version 2.4
Sometimes $weather->wind->direction
is NULL
getValue() on this throws fatal error.
I think, getValue() method must check own content
Thank you for raising this issue. AFAIK, this could only happen for weather group data. I fixed that in d55e066.
Nice. But in this version you use excessive libraries :(
At my small site I can't use version 2+ :(
Hi @KarelWintersky,
Could you elaborate a bit more on why the requirement to install additional libraries prevents you from using this library? I am trying to understand what prevents you from installing them. Or is the jump in the required PHP version from 5 to 7 the issue?
I wrote about this problem here: #136
However, most bigger projects will likely already have PSR-17/18-compatible libraries installed.
My project is small, frameworkless. And, I hope, quick and perfomance-oriented. I can't use a lot of libraries.
Also, with 'recommended' libraries it does not work.
Also, with 'recommended' libraries it does not work.
It appears to be working on my end. To test it, I created a new composer.json
file with the following contents and ran composer install
:
{
"name": "root/app",
"require": {
"cmfcmf/openweathermap-php-api": "^3.0",
"http-interop/http-factory-guzzle": "^1.0",
"php-http/guzzle6-adapter": "^2.0"
}
}
I then executed the example code from the README using PHP 7.3.5 successfully.
Our production server uses PHP 7.0.11 now :(
Our production server uses PHP 7.0.11 now :(
Ahh, I see. I haven't checked all dependencies, but on a quick glance it seams that at least the php-http/guzzle6-adapter
library requires PHP 7.1+. Given that PHP 7.0 is EOL for more than a year now, I don't think it is feasible for me to invest the necessary time to make the example work with PHP 7.0. I know that upgrading PHP versions isn't alsways possible or easy, but I suppose you could continue using version 2.3 of this library for now and backport your fix to to it.