1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-04 20:27:31 +02:00

Avoid chmoding unless requested, fixes #348

This commit is contained in:
Jordi Boggiano
2014-04-01 21:52:12 +02:00
parent 9ebcdcd7f2
commit f3032a2b98

View File

@@ -33,7 +33,7 @@ class StreamHandler extends AbstractProcessingHandler
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
* @param int $filePermissions Optional file permissions (default (0644) are only for owner read/write)
*/
public function __construct($stream, $level = Logger::DEBUG, $bubble = true, $filePermission = 0644)
public function __construct($stream, $level = Logger::DEBUG, $bubble = true, $filePermission = null)
{
parent::__construct($level, $bubble);
if (is_resource($stream)) {
@@ -68,7 +68,9 @@ class StreamHandler extends AbstractProcessingHandler
$this->errorMessage = null;
set_error_handler(array($this, 'customErrorHandler'));
$this->stream = fopen($this->url, 'a');
@chmod($this->url, $this->filePermission);
if ($this->filePermission !== null) {
@chmod($this->url, $this->filePermission);
}
restore_error_handler();
if (!is_resource($this->stream)) {
$this->stream = null;