php-http / message

HTTP Message related tools
http://php-http.org
MIT License
1.29k stars 41 forks source link

Invalid value returned by GzipEncodeStream::getSize #60

Closed ajgarlag closed 7 years ago

ajgarlag commented 7 years ago
Q A
Bug? yes
New Feature? no
Version b86b453

Actual Behavior

The GzipEncodeStream::getSize returns the size of the inner stream content.

Expected Behavior

The GzipEncodeStream::getSize should return the size of the gzipped body.

Steps to Reproduce

<?php
require 'vendor/autoload.php';

$payload = 'This is a test stream';

$innerStream = new spec\Http\Message\Encoding\MemoryStream($payload);
$gzipEncodedStream = new Http\Message\Encoding\GzipEncodeStream($innerStream);

var_dump($gzipEncodedStream->getContents() === gzencode($payload)); //It is true
var_dump($gzipEncodedStream->getSize() === strlen(gzencode($payload))); //Should be true
dbu commented 7 years ago

i am pretty sure you are correct and we should fix this.