Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ dist: trusty

matrix:
include:
- php: 5.3
dist: precise
script:
- vendor/bin/phpunit --coverage-text --verbose || [[ $? = 139 ]] # ignore SEGFAULT on legacy PHP 5.3 only
- php: 5.4
- php: 5.5
- php: 5.6
Expand All @@ -24,10 +20,8 @@ matrix:
- choco install php
- choco install composer
- export PATH="$(powershell -Command '("Process", "Machine" | % { [Environment]::GetEnvironmentVariable("PATH", $_) -Split ";" -Replace "\\$", "" } | Select -Unique | % { cygpath $_ }) -Join ":"')"
- php: hhvm-3.18
allow_failures:
- os: windows
- php: hhvm-3.18

install:
- composer install --no-interaction
Expand Down
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,10 @@ See also [`Compressor`](#compressor) for more details.
### Inconsistencies

The stream compression filters are not exactly the most commonly used features of PHP.
As such, we've spotted several inconsistencies (or *bugs*) between different PHP versions and HHVM.
As such, we've spotted some inconsistencies (or *bugs*) in different PHP versions.
These inconsistencies exist in the underlying PHP engines and there's little we can do about this in this library.

* All Zend PHP versions: Decompressing invalid data does not emit any data (and does not raise an error)
* HHVM only: does not currently support the GZIP and ZLIB format at all (and does not raise an error)
* HHVM only: The [`zlib.deflate` filter function](https://github.com/facebook/hhvm/blob/fee8ae39ce395c7b9b8910dfde6f22a7745aea83/hphp/system/php/stream/default-filters.php#L77) buffers the whole string. This means that compressing a stream of 100 MB actually stores the whole string in memory before invoking the underlying compression algorithm.
* PHP 5.3 only: Tends to SEGFAULT occasionally on shutdown?
* All PHP versions: Decompressing invalid data does not emit any data (and does not raise an error)

Our test suite contains several test cases that exhibit these issues.
If you feel some test case is missing or outdated, we're happy to accept PRs! :)
Expand All @@ -251,16 +248,18 @@ $ composer require clue/zlib-react:^0.2.2
See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.

This project aims to run on any platform and thus does not require any PHP
extensions and supports running on legacy PHP 5.3 through current PHP 7+ and
HHVM.
extensions and supports running on legacy PHP 5.4 through current PHP 7+.
It's *highly recommended to use PHP 7+* for this project.
Older PHP versions may suffer from a number of inconsistencies documented above.

The `ext-zlib` extension is not required to install this library, however it
is required to actually do anything meaningful with this library.
Each of the above methods will throw an `Exception` if this extension is
missing.

We're committed to providing a smooth upgrade path for legacy setups.
If you need to support legacy PHP 5.3 and legacy HHVM, you may want to check out
the legacy `v0.2.x` release branch.

## Tests

To run the test suite, you first need to clone this repo and then install all
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
],
"require": {
"php": ">=5.3",
"php": ">=5.4",
"clue/stream-filter": "~1.3",
"react/stream": "^1.0 || ^0.7 || ^0.6"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/91-benchmark-compress.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}

if (!defined('ZLIB_ENCODING_GZIP')) {
fwrite(STDERR, 'Requires PHP 5.4+ with ext-zlib enabled' . PHP_EOL);
fwrite(STDERR, 'Requires PHP with ext-zlib enabled' . PHP_EOL);
exit(1);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/92-benchmark-decompress.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}

if (!defined('ZLIB_ENCODING_GZIP')) {
fwrite(STDERR, 'Requires PHP 5.4+ with ext-zlib enabled' . PHP_EOL);
fwrite(STDERR, 'Requires PHP with ext-zlib enabled' . PHP_EOL);
exit(1);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/gunzip.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}

if (!defined('ZLIB_ENCODING_GZIP')) {
fwrite(STDERR, 'Requires PHP 5.4+ with ext-zlib enabled' . PHP_EOL);
fwrite(STDERR, 'Requires PHP with ext-zlib enabled' . PHP_EOL);
exit(1);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/gzip.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}

if (!defined('ZLIB_ENCODING_GZIP')) {
fwrite(STDERR, 'Requires PHP 5.4+ with ext-zlib enabled' . PHP_EOL);
fwrite(STDERR, 'Requires PHP with ext-zlib enabled' . PHP_EOL);
exit(1);
}

Expand Down
3 changes: 0 additions & 3 deletions tests/FunctionalExamplesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ public function setUp()
if (DIRECTORY_SEPARATOR === '\\') {
$this->markTestSkipped('Non-blocking console I/O not supported on Windows');
}
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('Not supported on HHVM (ignores window size / encoding format)');
}
}
public function testChain()
{
Expand Down
4 changes: 1 addition & 3 deletions tests/ZlibFilterDeflateDecompressorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ public function testInflateHelloWorld()

public function testInflateBig()
{
if (defined('HHVM_VERSION')) $this->markTestSkipped('Not supported on HHVM (final chunk will not be emitted)');

$this->decompressor->on('data', function ($data) use (&$buffered) {
$buffered .= $data;
});
Expand All @@ -52,7 +50,7 @@ public function testInflateBig()

public function testInflateInvalid()
{
if (!defined('HHVM_VERSION')) $this->markTestSkipped('Only supported on HHVM (other engines do not reject invalid data)');
$this->markTestSkipped('Not supported by any PHP version (neither does reject invalid data)');

$this->decompressor->on('data', $this->expectCallableNever());
$this->decompressor->on('error', $this->expectCallableOnce());
Expand Down
2 changes: 0 additions & 2 deletions tests/ZlibFilterGzipCompressorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ class ZlibFilterGzipCompressorTest extends TestCase

public function setUp()
{
if (defined('HHVM_VERSION')) $this->markTestSkipped('Not supported on HHVM (ignores window size / encoding format)');

$this->compressor = ZlibFilterStream::createGzipCompressor();
}

Expand Down
4 changes: 1 addition & 3 deletions tests/ZlibFilterGzipDecompressorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ class ZlibFilterGzipDecompressorTest extends TestCase

public function setUp()
{
if (defined('HHVM_VERSION')) $this->markTestSkipped('Not supported on HHVM (ignores window size / encoding format)');

$this->decompressor = ZlibFilterStream::createGzipDecompressor();
}

Expand Down Expand Up @@ -52,7 +50,7 @@ public function testDecompressBig()

public function testDecompressInvalid()
{
$this->markTestSkipped('Not supported by any PHP engine (neither does reject invalid data)');
$this->markTestSkipped('Not supported by any PHP version (neither does reject invalid data)');

$this->decompressor->on('data', $this->expectCallableNever());
$this->decompressor->on('error', $this->expectCallableOnce());
Expand Down
2 changes: 0 additions & 2 deletions tests/ZlibFilterZlibCompressorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ class ZlibFilterZlibCompressorTest extends TestCase

public function setUp()
{
if (defined('HHVM_VERSION')) $this->markTestSkipped('Not supported on HHVM (ignores window size / encoding format)');

$this->compressor = ZlibFilterStream::createZlibCompressor();
}

Expand Down
4 changes: 1 addition & 3 deletions tests/ZlibFilterZlibDecompressorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ class ZlibFilterZlibDecompressorTest extends TestCase

public function setUp()
{
if (defined('HHVM_VERSION')) $this->markTestSkipped('Not supported on HHVM (ignores window size / encoding format)');

$this->decompressor = ZlibFilterStream::createZlibDecompressor();
}

Expand Down Expand Up @@ -52,7 +50,7 @@ public function testDecompressBig()

public function testDecompressInvalid()
{
$this->markTestSkipped('Not supported by any PHP engine (neither does reject invalid data)');
$this->markTestSkipped('Not supported by any PHP version (neither does reject invalid data)');

$this->decompressor->on('data', $this->expectCallableNever());
$this->decompressor->on('error', $this->expectCallableOnce());
Expand Down