diff --git a/src/Compress/Bz2.php b/src/Compress/Bz2.php index 1e37109a..79716118 100644 --- a/src/Compress/Bz2.php +++ b/src/Compress/Bz2.php @@ -133,7 +133,9 @@ public function compress($content) public function decompress($content) { $archive = $this->getArchive(); - if (file_exists($content)) { + + //check if there are null byte characters before doing a file_exists check + if (!strstr($content, "\0") && file_exists($content)) { $archive = $content; } diff --git a/src/Compress/Gz.php b/src/Compress/Gz.php index cb1c47dc..57d05dfd 100644 --- a/src/Compress/Gz.php +++ b/src/Compress/Gz.php @@ -165,7 +165,9 @@ public function decompress($content) { $archive = $this->getArchive(); $mode = $this->getMode(); - if (file_exists($content)) { + + //check if there are null byte characters before doing a file_exists check + if (!strstr($content, "\0") && file_exists($content)) { $archive = $content; } diff --git a/test/Compress/Bz2Test.php b/test/Compress/Bz2Test.php index 0b62f232..645a9099 100644 --- a/test/Compress/Bz2Test.php +++ b/test/Compress/Bz2Test.php @@ -37,10 +37,6 @@ public function tearDown() */ public function testBasicUsage() { - if (version_compare(phpversion(), '5.4', '>=')) { - $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 '); - } - $filter = new Bz2Compression(); $content = $filter->compress('compress me'); diff --git a/test/Compress/GzTest.php b/test/Compress/GzTest.php index 51d9602d..1f901bca 100644 --- a/test/Compress/GzTest.php +++ b/test/Compress/GzTest.php @@ -37,10 +37,6 @@ public function tearDown() */ public function testBasicUsage() { - if (version_compare(phpversion(), '5.4', '>=')) { - $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 '); - } - $filter = new GzCompression(); $content = $filter->compress('compress me'); @@ -164,10 +160,6 @@ public function testGzCompressToFile() */ public function testGzDeflate() { - if (version_compare(phpversion(), '5.4', '>=')) { - $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 '); - } - $filter = new GzCompression(array('mode' => 'deflate')); $content = $filter->compress('compress me'); diff --git a/test/CompressTest.php b/test/CompressTest.php index fbcd47c1..2aed886d 100644 --- a/test/CompressTest.php +++ b/test/CompressTest.php @@ -37,10 +37,6 @@ public function tearDown() */ public function testBasicUsage() { - if (version_compare(phpversion(), '5.4', '>=')) { - $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 '); - } - $filter = new CompressFilter('bz2'); $text = 'compress me'; diff --git a/test/DecompressTest.php b/test/DecompressTest.php index cc46b531..b6e94752 100644 --- a/test/DecompressTest.php +++ b/test/DecompressTest.php @@ -37,10 +37,6 @@ public function tearDown() */ public function testBasicUsage() { - if (version_compare(phpversion(), '5.4', '>=')) { - $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 '); - } - $filter = new DecompressFilter('bz2'); $text = 'compress me'; diff --git a/test/Encrypt/BlockCipherTest.php b/test/Encrypt/BlockCipherTest.php index 2273cfbe..53759f2c 100644 --- a/test/Encrypt/BlockCipherTest.php +++ b/test/Encrypt/BlockCipherTest.php @@ -200,10 +200,6 @@ public function testSettingEmptyVector() */ public function testEncryptionWithDecryptionAndCompressionMcrypt() { - if (version_compare(phpversion(), '5.4', '>=')) { - $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 '); - } - if (!extension_loaded('bz2')) { $this->markTestSkipped('This adapter needs the bz2 extension'); } diff --git a/test/Encrypt/OpensslTest.php b/test/Encrypt/OpensslTest.php index 972946ed..e7f214c3 100644 --- a/test/Encrypt/OpensslTest.php +++ b/test/Encrypt/OpensslTest.php @@ -274,10 +274,6 @@ public function testEncryptionWithDecryptionWithPackagedKeys() */ public function testEncryptionWithDecryptionAndCompressionWithPackagedKeys() { - if (version_compare(phpversion(), '5.4', '>=')) { - $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 '); - } - if (!extension_loaded('bz2')) { $this->markTestSkipped('Bz2 extension for compression test needed'); }