From 3366d4bd3cfcc4a7240e6056719049887608ff48 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 20 Jul 2016 14:43:31 +0700 Subject: [PATCH 1/3] Fixes #35 : Encrypt/Openssl Unset Difference on __construct --- src/Encrypt/Openssl.php | 2 +- test/Encrypt/OpensslTest.php | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Encrypt/Openssl.php b/src/Encrypt/Openssl.php index 70a28289..9efb9c44 100644 --- a/src/Encrypt/Openssl.php +++ b/src/Encrypt/Openssl.php @@ -89,7 +89,7 @@ public function __construct($options = []) if (array_key_exists('compression', $options)) { $this->setCompression($options['compression']); - unset($options['compress']); + unset($options['compression']); } if (array_key_exists('package', $options)) { diff --git a/test/Encrypt/OpensslTest.php b/test/Encrypt/OpensslTest.php index 4c41831a..12a304ec 100644 --- a/test/Encrypt/OpensslTest.php +++ b/test/Encrypt/OpensslTest.php @@ -9,6 +9,7 @@ namespace ZendTest\Filter\Encrypt; +use ReflectionProperty; use Zend\Filter\Encrypt\Openssl as OpensslEncryption; /** @@ -278,4 +279,15 @@ public function testEncryptionWithDecryptionAndCompressionWithPackagedKeys() $input = $filter->decrypt($output); $this->assertEquals('teststring', trim($input)); } + + public function testPassCompressionConfigWillBeUnsetCorrectly() + { + $filter = new OpensslEncryption([ + 'compression' => 'bz2' + ]); + + $r = new ReflectionProperty($filter, 'keys'); + $r->setAccessible(true); + $this->assertArrayNotHasKey('compression', $r->getValue($filter)); + } } From 4c6e6698a97c23a5feabebb076edc4a77bad77fa Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 15 Sep 2016 22:00:17 +0700 Subject: [PATCH 2/3] trailing comma fix --- test/Encrypt/OpensslTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Encrypt/OpensslTest.php b/test/Encrypt/OpensslTest.php index 12a304ec..01b21c4b 100644 --- a/test/Encrypt/OpensslTest.php +++ b/test/Encrypt/OpensslTest.php @@ -283,7 +283,7 @@ public function testEncryptionWithDecryptionAndCompressionWithPackagedKeys() public function testPassCompressionConfigWillBeUnsetCorrectly() { $filter = new OpensslEncryption([ - 'compression' => 'bz2' + 'compression' => 'bz2', ]); $r = new ReflectionProperty($filter, 'keys'); From f22a771fcc28d3a79bf2d581b73a7f17ed303f8a Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Wed, 17 May 2017 15:33:12 -0500 Subject: [PATCH 3/3] Added CHANGELOG for #36 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index de26c9fc..d46d7099 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,9 @@ All notable changes to this project will be documented in this file, in reverse ensuring it is injecting the relevant configuration from the `config` service and thus seeding it with configured translator loader services. This means that the `filters` configuration will now be honored in non-zend-mvc contexts. +- [#36](https://github.com/zendframework/zend-filter/pull/36) fixes an issue in + the constructor whereby a discovered option was not removed from the options + list after being used to set the compression algorithm. ## 2.7.1 - 2016-04-18