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

[Zend\Filter\Compress] added PHP 5.4 support for strings in Bz2 and Gz decompress #5839

Merged
merged 2 commits into from
Feb 18, 2014
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
4 changes: 3 additions & 1 deletion library/Zend/Filter/Compress/Bz2.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ public function compress($content)
public function decompress($content) public function decompress($content)
{ {
$archive = $this->getArchive(); $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; $archive = $content;
} }


Expand Down
4 changes: 3 additions & 1 deletion library/Zend/Filter/Compress/Gz.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ public function decompress($content)
{ {
$archive = $this->getArchive(); $archive = $this->getArchive();
$mode = $this->getMode(); $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; $archive = $content;
} }


Expand Down
4 changes: 0 additions & 4 deletions tests/ZendTest/Filter/Compress/Bz2Test.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ public function tearDown()
*/ */
public function testBasicUsage() public function testBasicUsage()
{ {
if (version_compare(phpversion(), '5.4', '>=')) {
$this->markTestIncomplete('Code to test is not compatible with PHP 5.4 ');
}

$filter = new Bz2Compression(); $filter = new Bz2Compression();


$content = $filter->compress('compress me'); $content = $filter->compress('compress me');
Expand Down
8 changes: 0 additions & 8 deletions tests/ZendTest/Filter/Compress/GzTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ public function tearDown()
*/ */
public function testBasicUsage() public function testBasicUsage()
{ {
if (version_compare(phpversion(), '5.4', '>=')) {
$this->markTestIncomplete('Code to test is not compatible with PHP 5.4 ');
}

$filter = new GzCompression(); $filter = new GzCompression();


$content = $filter->compress('compress me'); $content = $filter->compress('compress me');
Expand Down Expand Up @@ -164,10 +160,6 @@ public function testGzCompressToFile()
*/ */
public function testGzDeflate() 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')); $filter = new GzCompression(array('mode' => 'deflate'));


$content = $filter->compress('compress me'); $content = $filter->compress('compress me');
Expand Down
4 changes: 0 additions & 4 deletions tests/ZendTest/Filter/CompressTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ public function tearDown()
*/ */
public function testBasicUsage() 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'); $filter = new CompressFilter('bz2');


$text = 'compress me'; $text = 'compress me';
Expand Down
4 changes: 0 additions & 4 deletions tests/ZendTest/Filter/DecompressTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ public function tearDown()
*/ */
public function testBasicUsage() 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'); $filter = new DecompressFilter('bz2');


$text = 'compress me'; $text = 'compress me';
Expand Down
4 changes: 0 additions & 4 deletions tests/ZendTest/Filter/Encrypt/BlockCipherTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -200,10 +200,6 @@ public function testSettingEmptyVector()
*/ */
public function testEncryptionWithDecryptionAndCompressionMcrypt() 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')) { if (!extension_loaded('bz2')) {
$this->markTestSkipped('This adapter needs the bz2 extension'); $this->markTestSkipped('This adapter needs the bz2 extension');
} }
Expand Down
4 changes: 0 additions & 4 deletions tests/ZendTest/Filter/Encrypt/OpensslTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -274,10 +274,6 @@ public function testEncryptionWithDecryptionWithPackagedKeys()
*/ */
public function testEncryptionWithDecryptionAndCompressionWithPackagedKeys() 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')) { if (!extension_loaded('bz2')) {
$this->markTestSkipped('Bz2 extension for compression test needed'); $this->markTestSkipped('Bz2 extension for compression test needed');
} }
Expand Down