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

Commit fa1d688

Browse files
committed
Merge branch 'hotfix/signatures'
Close #79
2 parents 107877c + 54f647b commit fa1d688

File tree

4 files changed

+69
-23
lines changed

4 files changed

+69
-23
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ matrix:
5252
env:
5353
- EVENT_MANAGER_VERSION="^2.6.2"
5454
- SERVICE_MANAGER_VERSION="^2.7.5"
55+
- php: 7.1
56+
- php: 7.1
57+
env:
58+
- EVENT_MANAGER_VERSION="^2.6.2"
59+
- SERVICE_MANAGER_VERSION="^2.7.5"
5560
- php: hhvm
5661
- php: hhvm
5762
env:

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
All notable changes to this project will be documented in this file, in reverse chronological order by release.
44

5-
## 2.7.4 - TBD
5+
## 2.7.4 - 2017-06-19
66

77
### Added
88

@@ -21,6 +21,10 @@ All notable changes to this project will be documented in this file, in reverse
2121
- [#66](https://github.com/zendframework/zend-session/pull/66) fixes how the
2222
`Cache` save handler's `destroy()` method works, ensuring it does not attempt
2323
to remove an item by `$id` if it does not already exist in the cache.
24+
- [#79](https://github.com/zendframework/zend-session/pull/79) updates the
25+
signature of `AbstractContainer::offsetGet()` to match
26+
`Zend\Stdlib\ArrayObject` and return by reference, fixing an issue when
27+
running under PHP 7.1+.
2428

2529
## 2.7.3 - 2016-07-05
2630

src/AbstractContainer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ public function offsetExists($key)
422422
* @param string $key
423423
* @return mixed
424424
*/
425-
public function offsetGet($key)
425+
public function &offsetGet($key)
426426
{
427427
if (! $this->offsetExists($key)) {
428428
return;

test/Config/SessionConfigTest.php

Lines changed: 58 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ public function setUp()
2828
$this->config = new SessionConfig;
2929
}
3030

31+
public function assertPhpLessThan71()
32+
{
33+
if (version_compare(PHP_VERSION, '7.1.0', '<')) {
34+
return true;
35+
}
36+
$this->markTestSkipped('This test requires a PHP version less than 7.1.0');
37+
}
38+
3139
// session.save_path
3240

3341
public function testSetSavePathErrorsOnInvalidPath()
@@ -496,23 +504,27 @@ public function testRefererCheckAltersIniSetting()
496504

497505
public function testSetEntropyFileErrorsOnInvalidPath()
498506
{
507+
$this->assertPhpLessThan71();
499508
$this->setExpectedException('Zend\Session\Exception\InvalidArgumentException', 'Invalid entropy_file provided');
500509
$this->config->setEntropyFile(__DIR__ . '/foobarboguspath');
501510
}
502511

503512
public function testEntropyFileDefaultsToIniSettings()
504513
{
514+
$this->assertPhpLessThan71();
505515
$this->assertSame(ini_get('session.entropy_file'), $this->config->getEntropyFile());
506516
}
507517

508518
public function testEntropyFileIsMutable()
509519
{
520+
$this->assertPhpLessThan71();
510521
$this->config->setEntropyFile(__FILE__);
511522
$this->assertEquals(__FILE__, $this->config->getEntropyFile());
512523
}
513524

514525
public function testEntropyFileAltersIniSetting()
515526
{
527+
$this->assertPhpLessThan71();
516528
$this->config->setEntropyFile(__FILE__);
517529
$this->assertEquals(__FILE__, ini_get('session.entropy_file'));
518530
}
@@ -521,29 +533,34 @@ public function testEntropyFileAltersIniSetting()
521533

522534
public function testEntropyLengthDefaultsToIniSettings()
523535
{
536+
$this->assertPhpLessThan71();
524537
$this->assertSame(ini_get('session.entropy_length'), $this->config->getEntropyLength());
525538
}
526539

527540
public function testEntropyLengthIsMutable()
528541
{
542+
$this->assertPhpLessThan71();
529543
$this->config->setEntropyLength(20);
530544
$this->assertEquals(20, $this->config->getEntropyLength());
531545
}
532546

533547
public function testEntropyLengthAltersIniSetting()
534548
{
549+
$this->assertPhpLessThan71();
535550
$this->config->setEntropyLength(24);
536551
$this->assertEquals(24, ini_get('session.entropy_length'));
537552
}
538553

539554
public function testEntropyLengthCanBeZero()
540555
{
556+
$this->assertPhpLessThan71();
541557
$this->config->setEntropyLength(0);
542558
$this->assertEquals(0, ini_get('session.entropy_length'));
543559
}
544560

545561
public function testSettingInvalidEntropyLengthRaisesException()
546562
{
563+
$this->assertPhpLessThan71();
547564
$this->setExpectedException(
548565
'Zend\Session\Exception\InvalidArgumentException',
549566
'Invalid entropy_length; must be numeric'
@@ -553,6 +570,7 @@ public function testSettingInvalidEntropyLengthRaisesException()
553570

554571
public function testSettingInvalidEntropyLengthRaisesException2()
555572
{
573+
$this->assertPhpLessThan71();
556574
$this->setExpectedException(
557575
'Zend\Session\Exception\InvalidArgumentException',
558576
'Invalid entropy_length; must be a positive integer or zero'
@@ -677,6 +695,7 @@ public function hashFunctions()
677695

678696
public function testHashFunctionDefaultsToIniSettings()
679697
{
698+
$this->assertPhpLessThan71();
680699
$this->assertSame(ini_get('session.hash_function'), $this->config->getHashFunction());
681700
}
682701

@@ -685,6 +704,7 @@ public function testHashFunctionDefaultsToIniSettings()
685704
*/
686705
public function testHashFunctionIsMutable($hashFunction)
687706
{
707+
$this->assertPhpLessThan71();
688708
$this->config->setHashFunction($hashFunction);
689709
$this->assertEquals($hashFunction, $this->config->getHashFunction());
690710
}
@@ -694,12 +714,14 @@ public function testHashFunctionIsMutable($hashFunction)
694714
*/
695715
public function testHashFunctionAltersIniSetting($hashFunction)
696716
{
717+
$this->assertPhpLessThan71();
697718
$this->config->setHashFunction($hashFunction);
698719
$this->assertEquals($hashFunction, ini_get('session.hash_function'));
699720
}
700721

701722
public function testSettingInvalidHashFunctionRaisesException()
702723
{
724+
$this->assertPhpLessThan71();
703725
$this->setExpectedException(
704726
'Zend\Session\Exception\InvalidArgumentException',
705727
'Invalid hash function provided'
@@ -728,6 +750,7 @@ public function testHashBitsPerCharacterDefaultsToIniSettings()
728750
*/
729751
public function testHashBitsPerCharacterIsMutable($hashBitsPerCharacter)
730752
{
753+
$this->assertPhpLessThan71();
731754
$this->config->setHashBitsPerCharacter($hashBitsPerCharacter);
732755
$this->assertEquals($hashBitsPerCharacter, $this->config->getHashBitsPerCharacter());
733756
}
@@ -737,12 +760,14 @@ public function testHashBitsPerCharacterIsMutable($hashBitsPerCharacter)
737760
*/
738761
public function testHashBitsPerCharacterAltersIniSetting($hashBitsPerCharacter)
739762
{
763+
$this->assertPhpLessThan71();
740764
$this->config->setHashBitsPerCharacter($hashBitsPerCharacter);
741765
$this->assertEquals($hashBitsPerCharacter, ini_get('session.hash_bits_per_character'));
742766
}
743767

744768
public function testSettingInvalidHashBitsPerCharacterRaisesException()
745769
{
770+
$this->assertPhpLessThan71();
746771
$this->setExpectedException(
747772
'Zend\Session\Exception\InvalidArgumentException',
748773
'Invalid hash bits per character provided'
@@ -836,7 +861,7 @@ public function testSetOptionsTranslatesUnderscoreSeparatedKeys($option, $getter
836861

837862
public function optionsProvider()
838863
{
839-
return [
864+
$options = [
840865
[
841866
'save_path',
842867
'getSavePath',
@@ -912,16 +937,6 @@ public function optionsProvider()
912937
'getRefererCheck',
913938
'foobar',
914939
],
915-
[
916-
'entropy_file',
917-
'getEntropyFile',
918-
__FILE__,
919-
],
920-
[
921-
'entropy_length',
922-
'getEntropyLength',
923-
42,
924-
],
925940
[
926941
'cache_limiter',
927942
'getCacheLimiter',
@@ -937,21 +952,43 @@ public function optionsProvider()
937952
'getUseTransSid',
938953
true,
939954
],
940-
[
941-
'hash_function',
942-
'getHashFunction',
943-
'md5',
944-
],
945-
[
946-
'hash_bits_per_character',
947-
'getOption',
948-
5,
949-
],
950955
[
951956
'url_rewriter_tags',
952957
'getUrlRewriterTags',
953958
'a=href',
954959
],
955960
];
961+
962+
// These options are no longer present as of PHP 7.1.0
963+
if (version_compare(PHP_VERSION, '7.1.0', '<')) {
964+
$options[] = [
965+
'entropy_file',
966+
'getEntropyFile',
967+
__FILE__,
968+
];
969+
$options[] = [
970+
'entropy_length',
971+
'getEntropyLength',
972+
42,
973+
];
974+
$options[] = [
975+
'hash_bits_per_character',
976+
'getOption',
977+
5,
978+
];
979+
// The docs do not say this was removed for 7.1.0, but tests fail
980+
// on 7.1.0 due to this one.
981+
$options[] = [
982+
'hash_function',
983+
'getHashFunction',
984+
'md5',
985+
];
986+
}
987+
988+
// At some point, need to add support for session.sid_bits_per_character
989+
if (version_compare(PHP_VERSION, '7.1.0', '>=')) {
990+
}
991+
992+
return $options;
956993
}
957994
}

0 commit comments

Comments
 (0)