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

Commit

Permalink
Merge branch 'hotfix/3046' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Config/StandardConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ public function getUseCookies()
*/
public function setEntropyFile($entropyFile)
{
if (!is_file($entropyFile) || !is_readable($entropyFile)) {
if (!is_readable($entropyFile)) {
throw new Exception\InvalidArgumentException(sprintf(
"Invalid entropy_file provided: '%s'; doesn't exist or not readable",
$entropyFile
Expand Down
6 changes: 0 additions & 6 deletions test/Config/SessionConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,12 +460,6 @@ public function testSetEntropyFileErrorsOnInvalidPath()
$this->config->setEntropyFile(__DIR__ . '/foobarboguspath');
}

public function testSetEntropyFileErrorsOnDirectory()
{
$this->setExpectedException('Zend\Session\Exception\InvalidArgumentException', 'Invalid entropy_file provided');
$this->config->setEntropyFile(__DIR__);
}

public function testEntropyFileDefaultsToIniSettings()
{
$this->assertSame(ini_get('session.entropy_file'), $this->config->getEntropyFile());
Expand Down
22 changes: 16 additions & 6 deletions test/Config/StandardConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,6 @@ public function testSetEntropyFileErrorsOnInvalidPath()
$this->config->setEntropyFile(__DIR__ . '/foobarboguspath');
}

public function testSetEntropyFileErrorsOnDirectory()
{
$this->setExpectedException('Zend\Session\Exception\InvalidArgumentException', 'Invalid entropy_file provided');
$this->config->setEntropyFile(__DIR__);
}

public function testEntropyFileIsMutable()
{
$this->config->setEntropyFile(__FILE__);
Expand Down Expand Up @@ -565,4 +559,20 @@ public function optionsProvider()
),
);
}

/**
* Set entropy file /dev/urandom, see issue #3046
*
* @link https://github.com/zendframework/zf2/issues/3046
*/
public function testSetEntropyDevUrandom()
{
if (!file_exists('/dev/urandom')) {
$this->markTestSkipped(
"This test doesn't work because /dev/urandom file doesn't exist."
);
}
$result = $this->config->setEntropyFile('/dev/urandom');
$this->assertInstanceOf('Zend\Session\Config\StandardConfig', $result);
}
}

0 comments on commit 3f1c2ef

Please sign in to comment.