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

Response class blindly attempts to inflate empty body #76

Closed
GeeH opened this issue Jun 28, 2016 · 2 comments
Closed

Response class blindly attempts to inflate empty body #76

GeeH opened this issue Jun 28, 2016 · 2 comments
Labels

Comments

@GeeH
Copy link
Contributor

GeeH commented Jun 28, 2016

This issue has been moved from the zendframework repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html


Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/7220
User: @miguelsimoes
Created On: 2015-02-14T16:44:51Z
Updated At: 2015-11-06T20:31:08Z
Body
Looking at the code:

    ErrorHandler::start();
    $return = gzinflate(substr($body, 10));
    $test = ErrorHandler::stop();
    if ($test) {
        throw new Exception\RuntimeException(
            'Error occurred during gzip inflation',
            0,
            $test
        );
    }

That exists in the decodeGzip method under the \Zend\HttpResponse FQCN, this breaks when you get a Content-Encoding: gzip header with empty body. The Response class should verify the Content-Length associated with the response before blindly attempt to call the decodeGzip method.


@YuraKril
Copy link

YuraKril commented Aug 6, 2018

Are there any updates?

@Ocramius
Copy link
Member

Ocramius commented Aug 7, 2018

@YuraKril if you experience this as well, please open a PR with a failing test case.

@Ocramius Ocramius added the bug label Aug 7, 2018
thomasvargiu added a commit to thomasvargiu/zend-http that referenced this issue Oct 13, 2018
weierophinney added a commit that referenced this issue Jan 8, 2019
…ore-deconding

#76 Check content-length before to decode response body
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants