zendframework / zend-http

Http component from Zend Framework
BSD 3-Clause "New" or "Revised" License
134 stars 85 forks source link

Response class blindly attempts to inflate empty body #76

Closed GeeH closed 5 years ago

GeeH commented 8 years ago

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 commented 6 years ago

Are there any updates?

Ocramius commented 6 years ago

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