Php-graph-sdk: The sdk not working at all - can not parse http/2 response code

Created on 4 Dec 2018  ·  12Comments  ·  Source: facebookarchive/php-graph-sdk

The faulty method is this:

public function setHttpResponseCodeFromHeader($rawResponseHeader) { preg_match('|HTTP/\d\.\d\s+(\d+)\s+.*|', $rawResponseHeader, $match); $this->httpResponseCode = (int)$match[1]; }

it will parse only HTTP/1.1, will not parse HTTP/2 - this makes current version of sdk useless

The faulty version is 5.6.3 that is available on packagist.

Most helpful comment

PR fixing this was merged almost a month ago. https://github.com/facebook/php-graph-sdk/pull/1079

All 12 comments

Having the same issue...

In case we change the code to:

public function setHttpResponseCodeFromHeader($rawResponseHeader)
{
    preg_match('|HTTP/\d\s+(\d+)|', $rawResponseHeader, $match);
    $this->httpResponseCode = (int)$match[1];
}

It works again :) Just changed regular expression to accept HTTP/2 .
But it would be cool if we add it for both versions of HTTP (1.1 and 2)

I have the same issue. I moved to the stream http_client_handler so it doesn't use h2 to perform requests.

Ouch, just experienced this bug in our app. Any time frame when it will be fixed?

PR fixing this was merged almost a month ago. https://github.com/facebook/php-graph-sdk/pull/1079

I'm hoping we can get a patch version rather than wait for 5.7. 🙏

@yguedidi Having the same issue, why isn't this patched in 5.6?

Also, there is no way of using 5.x in Composer because it's not registered as a branch alias (see https://packagist.org/packages/facebook/graph-sdk)

Honestly, I'm not sure a release is coming soon, probably not at this time of the year.
I forked the repo and used my own branch for now, I'll get rid of this when 5.7 is out.

  1. fork repository
  2. update composer.json
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/julienbourdeau/php-graph-sdk"
        }
    ],
    "require": {
        "php": "^7.1.3",
        "facebook/graph-sdk": "5.x-dev"
    },
  1. delete vendor folder (just in case) rm -rf vendor/facebook
  2. Update with composer update

@julienbourdeau FYI, No need for a fork, you can also do this:

"repositories": [{
            "type": "vcs",
            "url": "http://github.com/facebook/php-graph-sdk"
        }
],
    "require": {
        "php": "^7.1.3",
        "facebook/graph-sdk": "5.x-dev"
    },

That's what I expected but for some reason, it didn't work. I didn't want waste too much time so I didn't look into the details ¯_(ツ)_/¯

5.7.0 finally released! Sorry for the delay.. Thanks to who provide workarounds!

Was this page helpful?
0 / 5 - 0 ratings