Skip to content

Commit

Permalink
Closes #3235 by backporting 32cbcdf
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Aug 3, 2018
1 parent c535b1c commit 506dd60
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Util/Printer.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function __construct($out = null)
$this->out = \fsockopen($out[0], $out[1]);
} else {
if (\strpos($out, 'php://') === false && !\is_dir(\dirname($out))) {
\mkdir(\dirname($out), 0777, true);
$this->createDirectory(\dirname($out));
}

$this->out = \fopen($out, 'wt');
Expand Down Expand Up @@ -143,4 +143,9 @@ public function setAutoFlush($autoFlush)
throw InvalidArgumentHelper::factory(1, 'boolean');
}
}

private function createDirectory(string $directory): bool
{
return !(!\is_dir($directory) && !@\mkdir($directory, 0777, true) && !\is_dir($directory));
}
}

0 comments on commit 506dd60

Please sign in to comment.