Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Changed default version service to Zend. #4331

Closed
wants to merge 1 commit into from
Closed

Changed default version service to Zend. #4331

wants to merge 1 commit into from

Conversation

glen-84
Copy link
Contributor

@glen-84 glen-84 commented Apr 26, 2013

No description provided.

weierophinney added a commit that referenced this pull request Apr 26, 2013
weierophinney added a commit that referenced this pull request Apr 26, 2013
@ghost ghost assigned weierophinney Apr 26, 2013
@weierophinney
Copy link
Member

Merged to develop for release with 2.2.0. Thanks!

@demonkoryu
Copy link
Contributor

I don't know if this was posted somewhere, but the github error can be fixed by setting the INI value user_agent to some string value.

@robkorv
Copy link

robkorv commented May 1, 2013

setting the INI value user_agent seems to fix it on Ubuntu (12.04)
/etc/php5/apache2/php.ini (line 915)

user_agent="PHP"

@demonkoryu
Copy link
Contributor

This is a Github API issue. Setting user_agent will fix this for sure.

@stephandesouza
Copy link
Contributor

file_get_content() can't read values from SSL/HTTPS without context, needing some workaround to work.

Also the GitHub API v3 require "User Agent" on all request: http://developer.github.com/v3/#user-agent-required

User Agent Required

All API requests MUST include a valid User-Agent header. Requests with no User-Agent header will be rejected. We request that you use your GitHub username, or the name of your application, for the User-Agent header value. This allows us to contact you if there are problems.

@glen-84
Copy link
Contributor Author

glen-84 commented Jun 14, 2013

@weierophinney, @stephandesouza

So I guess this could be fixed by using a stream context, something like:

$url  = 'https://api.github.com/repos/zendframework/zf2/git/refs/tags/release-';

$opts = array(
    'http' => array('user_agent' => sprintf('Zend Framework %s', self::VERSION))
);

$context = stream_context_create($opts);

$apiResponse = Json::decode(file_get_contents($url, false, $context), Json::TYPE_ARRAY);

(untested)

@gws
Copy link
Contributor

gws commented Jun 14, 2013

@glen-84 I just integrated this suggestion into #4625 which has some other enhancements, (including fixing broken unit tests), and one test that exercises the Github API without Zend\Http\Client which failed prior to using a stream context as you point out here. Is that OK?

@glen-84
Copy link
Contributor Author

glen-84 commented Jun 14, 2013

@Gwis Certainly. :-)

@stephandesouza
Copy link
Contributor

Yes @glen-84, I do some work on #4658, but forget to implement the cURL client like @Gwis did on #4625.

@glen-84 glen-84 deleted the bugfix/default-version-service branch June 18, 2017 08:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants