-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Conversation
Travis is failing on 5.3.3, but I think this is only because master is currently failing. |
Like @weierophinney said, it'd be better to detect the ini settings before forcing an http client to be used. I suppose it would cover both people having allow_fopen_url = "1" but no cURL support and those with allow_fopen_url = "0" with cURL support. Then I guess it would return false (and a warning/exception ?) if neither file_get_contents or cURL is available. |
He said
This is "alternately," and it should cover everybody regardless of environment support. |
Well the file_get_contents method "covered everybody" but yet didn't always work depending your ini settings. Here, I can inject a client if I have no wrapper but the other way around doesn't work. So I'd still be screwed if I had no cURL support but a working wrapper, which IMHO is the case of more people. I'd be more in favor of
|
So not everyone is covered - that's the reason for making this change in the first place. #4610
How? |
fclose($handle); | ||
} | ||
} | ||
if (null !== self::$latestVersion) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use static instead of self.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self
make more sense, because this class is marked as final
, which means that this class cannot be extended.
What I am saying is that issue #4610 is about handling the warning, not changing the implementation already in place. So the workflow would be: detect ini settings, trigger E_USER_WARNING if problem, then return false or proceed with Http\Client if it is set. But if the client is relying on Socket, which I am not familiar with, then why not. |
I see what you're saying. My thinking is that if we're already introducing the dependency on |
Makes sense, besides I just checked Socket and it seems to be handling everything internally already, so my bad :p . For the BC: it should have returned "not available" like it's done already. |
I'm going to be up-front and say that I'm a bit hesitant to add a dependency on zend-http to zend-version. At best, it should be optional: if no HTTP client is passed to the |
@weierophinney Understood. Updated and tests added. |
With this update, we can perform version checks without relying on the environment having allow_url_fopen = 1. You can now optionally pass in a Zend\Http\Client instance. Tests are enhanced to run in a separate process to avoid problems during online tests where tests would not actually be run because the class would cache the first response, and subsequent responses would use that cached response. - Emit helpful warning if allow_url_fopen is not set - Split Github/Zend service calls into their own methods - Early return cached version to reduce nesting - Rename methods for consistency - Consistent usage of self:: instead of static:: as the class is marked 'final'
* | ||
* @return bool | ||
*/ | ||
public static function isLatest() | ||
{ | ||
return static::compareVersion(static::getLatest()) < 1; | ||
return self::compareVersion(self::getLatest()) < 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you change static:: to self:: ?
static:: provides more flexibility for extending classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class cannot be extended, its a final class.
Use Zend\Http\Client in Zend\Version
Merged to develop for release with 2.3.0 (as it introduces new features). |
With this update, we can perform version checks without relying on the
environment having allow_url_fopen = 1.
We can now optionally pass in a Zend\Http\Client instance.
Tests were enhanced to run in a separate process to avoid problems during online
tests where tests would not actually be run because the class would cache the
first response, and subsequent responses would use that cached response.
This addresses #4610