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

Commit

Permalink
Merge branch 'security/zf2015-07'
Browse files Browse the repository at this point in the history
Addresses ZF2015-07
  • Loading branch information
weierophinney committed Sep 15, 2015
2 parents e47212e + e7704a2 commit b656b63
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/Pattern/CaptureCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,14 @@ protected function createDirectoryStructure($pathname)
// build-in mkdir function is enough

$umask = ($umask !== false) ? umask($umask) : false;
$res = mkdir($pathname, ($perm !== false) ? $perm : 0777, true);
$res = mkdir($pathname, ($perm !== false) ? $perm : 0775, true);

if ($umask !== false) {
umask($umask);
}

if (!$res) {
$oct = ($perm === false) ? '777' : decoct($perm);
$oct = ($perm === false) ? '775' : decoct($perm);
$err = ErrorHandler::stop();
throw new Exception\RuntimeException("mkdir('{$pathname}', 0{$oct}, true) failed", 0, $err);
}
Expand Down Expand Up @@ -340,13 +340,13 @@ protected function createDirectoryStructure($pathname)

// create a single directory, set and reset umask immediately
$umask = ($umask !== false) ? umask($umask) : false;
$res = mkdir($path, ($perm === false) ? 0777 : $perm, false);
$res = mkdir($path, ($perm === false) ? 0775 : $perm, false);
if ($umask !== false) {
umask($umask);
}

if (!$res) {
$oct = ($perm === false) ? '777' : decoct($perm);
$oct = ($perm === false) ? '775' : decoct($perm);
ErrorHandler::stop();
throw new Exception\RuntimeException(
"mkdir('{$path}', 0{$oct}, false) failed"
Expand Down
2 changes: 1 addition & 1 deletion src/Pattern/PatternOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ public function setUmask($umask)
}

// normalize
$umask = $umask & 0777;
$umask = $umask & ~0002;
}

$this->umask = $umask;
Expand Down
8 changes: 4 additions & 4 deletions src/Storage/Adapter/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,7 @@ protected function prepareDirectoryStructure($file)
// build-in mkdir function is enough

$umask = ($umask !== false) ? umask($umask) : false;
$res = mkdir($pathname, ($perm !== false) ? $perm : 0777, true);
$res = mkdir($pathname, ($perm !== false) ? $perm : 0775, true);

if ($umask !== false) {
umask($umask);
Expand All @@ -1421,7 +1421,7 @@ protected function prepareDirectoryStructure($file)
return;
}

$oct = ($perm === false) ? '777' : decoct($perm);
$oct = ($perm === false) ? '775' : decoct($perm);
throw new Exception\RuntimeException("mkdir('{$pathname}', 0{$oct}, true) failed", 0, $err);
}

Expand Down Expand Up @@ -1453,7 +1453,7 @@ protected function prepareDirectoryStructure($file)

// create a single directory, set and reset umask immediately
$umask = ($umask !== false) ? umask($umask) : false;
$res = mkdir($path, ($perm === false) ? 0777 : $perm, false);
$res = mkdir($path, ($perm === false) ? 0775 : $perm, false);
if ($umask !== false) {
umask($umask);
}
Expand All @@ -1466,7 +1466,7 @@ protected function prepareDirectoryStructure($file)
continue;
}

$oct = ($perm === false) ? '777' : decoct($perm);
$oct = ($perm === false) ? '775' : decoct($perm);
ErrorHandler::stop();
throw new Exception\RuntimeException(
"mkdir('{$path}', 0{$oct}, false) failed"
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/Adapter/FilesystemOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ public function setUmask($umask)
}

// normalize
$umask = $umask & 0777;
$umask = $umask & ~0002;
}

if ($this->umask !== $umask) {
Expand Down
2 changes: 1 addition & 1 deletion test/Storage/Adapter/FilesystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public function testSetDirLevelInvalidException()
public function testSetUmask()
{
$this->_options->setUmask(023);
$this->assertSame(023, $this->_options->getUmask());
$this->assertSame(021, $this->_options->getUmask());

$this->_options->setUmask(false);
$this->assertFalse($this->_options->getUmask());
Expand Down

0 comments on commit b656b63

Please sign in to comment.