From f3032a2b9874aa76efcc155eff776eabdf322d05 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 1 Apr 2014 21:52:12 +0200 Subject: [PATCH] Avoid chmoding unless requested, fixes #348 --- src/Monolog/Handler/StreamHandler.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Monolog/Handler/StreamHandler.php b/src/Monolog/Handler/StreamHandler.php index 98947345..7bfbbe5e 100644 --- a/src/Monolog/Handler/StreamHandler.php +++ b/src/Monolog/Handler/StreamHandler.php @@ -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;