Skip to content

Problem when fetching group members #97

Closed
@khrizt

Description

@khrizt

Hi,

I found a problem when using the api to get group members, doing this query

$groupMembers = $this->gitlabClient->api('groups')->members($groupId, 1, 200);

I found that the response headers were truncated somehow and the headers returned this item:

Array
(
    [0] => HTTP/1.1 200 OK
    [1] => Date: Tue, 30 Jun 2015 13:38:01 GMT
    [2] => Server: Apache
    [3] => Link: <http://gitlab.fake/api/v3/groups/11/members?page=1&per_page=200>; rel="first", <http://gitlab.fake/api/v3/groups/11/members?page=1&per_page=200>; rel="last"
    [4] => Cache-Control: max-age=0, private, must-revalidate
    [5] => X-Request-Id: 4a04e42a-38cd-4154-8379-d6dd98ff83ac
    [6] => X-Runtime: 0.233594
    [7] => X-Powered-By: Phusion Passenger 4.0.57
    [8] => X-Frame-Options: SAMEORIGIN
    [9] => Content-Length: 6075
    [10] => ETag: "3dc10d7325d764b4ff657fa0e5227142"
    [11] => Status: 200 OK
    [12] => Content-Type: applicatio
)

Doing a little research I found that the problem seems to be in the populateResponse method of the Buzz\Client\AbstractCurl class, in this method makes the following control structure

        if (version_compare($version['version'], '7.30.0', '<')) {
            $pos = strlen($raw) - curl_getinfo($curl, CURLINFO_SIZE_DOWNLOAD);
        } else {
            $pos = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
        }

And in my case the $pos variable has 10 characters less than it should have so the headers are truncated and therefore no json_decode is applied to the current response. I know it's not probably your responsibility, more a Buzz library problem. But I wanted to note it here also if you know or can think of a solution.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions