Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting "Error Fetching http body, No Content-Length, connection closed or chunked data" on some versions of PHP < 5.4.x. #24

Closed
patekuru opened this issue Mar 19, 2014 · 10 comments
Assignees

Comments

@patekuru
Copy link

This issue was invalid.

@saturnism
Copy link
Contributor

@patekuru can this issue be closed?

@patekuru
Copy link
Author

yes. sorry.

On Wed, Mar 19, 2014 at 9:59 PM, Ray Tsang notifications@github.com wrote:

@patekuru https://github.com/patekuru can this issue be closed?

Reply to this email directly or view it on GitHubhttps://github.com//issues/24#issuecomment-38128434
.

The content of this email is CONFIDENTIAL.

@saturnism
Copy link
Contributor

no worries - cheers!

@vtsao
Copy link
Contributor

vtsao commented Mar 20, 2014

This issue is valid, I'm working on a fix. Some versions of PHP (like 5.2) do not handle the HTTP 1.1 protocol's chunked data transfer mechanism/feature. We should do a check or something.

@vtsao vtsao reopened this Mar 20, 2014
@vtsao vtsao self-assigned this Mar 20, 2014
@patekuru
Copy link
Author

Just Fyi, i personally DO currently have v201402 WORKING OK on my PHP 5.2.17 server. But, v201306, which i had had running on the same server for many months, had started to work intermittently (only about 1 out of 10 attempts), starting on about March 18th or 19th. This seemed ot me to have been related to google's technique of "strongly encouraging" upgrades to their newest "v" by gradually making the old "v" work intermittently in advance of the official sunset date. Since i solved it (apparently by upgrading from v201306 to v201402), i stopped digging around. this is just fyi, personally this issue is solved for me.

@patekuru
Copy link
Author

Actually now the "Error Fetching http body, No Content-Length, connection closed or chunked data" has returned, still on PHP 5.2.17 server using v201402.

The only thing i can think of might be that although my server & PHP scripts are a constant (unchanging) matter, whether or not the google API server returns a PHP 5.2.17 - compatible response varies. So yes, i agree this issue is valid.

@vtsao
Copy link
Contributor

vtsao commented Mar 21, 2014

The clarify the issue, it is with some versions of PHP not handling decoding HTTP 1.1 responses when the response uses the chunked data mechanism. The fix for now is to do the following:

In the file Google/Api/Ads/Common/Lib/SoapClientFactory.php,
right before line 147 where the line says "$options['stream_context'] = stream_context_create($contextOptions);"

add the following line of code:
$contextOptions['http']['protocol_version'] = 1.0;

This forces the client library to make requests with HTTP 1.0, which is not ideal. What you should do if you can is update your version of PHP to a version > 5.3 as this issue seems to occur in some versions of 5.3.x as well. This is a PHP language bug.

@patekuru
Copy link
Author

Thanks! Btw even before i added $contextOptions['http']['protocol_version'] = 1.0; it started working again, but i've added it now, and i'll monitor whether it causes things to work 100% of the time, rather than just intermittently.

@vtsao vtsao changed the title PHP 5.2 compatibility Getting "Error Fetching http body, No Content-Length, connection closed or chunked data" on some versions of PHP < 5.4.x. Mar 23, 2014
@vtsao
Copy link
Contributor

vtsao commented Apr 1, 2014

Fixed in 5.2.2.

@vtsao vtsao closed this as completed Apr 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants