From dcbb7bce2f5383fd0b17c0c883d60835a5a964d2 Mon Sep 17 00:00:00 2001 From: "Birkir A. Barkarson" Date: Thu, 10 Oct 2013 16:49:24 +0900 Subject: [PATCH] Changes from comments. - Move private instance variable. - Reset errorMessage. - See https://github.com/Seldaek/monolog/pull/248 --- src/Monolog/Handler/StreamHandler.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Monolog/Handler/StreamHandler.php b/src/Monolog/Handler/StreamHandler.php index 108f0397..66c36acc 100644 --- a/src/Monolog/Handler/StreamHandler.php +++ b/src/Monolog/Handler/StreamHandler.php @@ -24,6 +24,7 @@ class StreamHandler extends AbstractProcessingHandler { protected $stream; protected $url; + private $errorMessage; /** * @param string $stream @@ -60,6 +61,7 @@ class StreamHandler extends AbstractProcessingHandler if (!$this->url) { throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().'); } + $errorMessage = null; set_error_handler(array($this, 'customErrorHandler')); $this->stream = fopen($this->url, 'a'); restore_error_handler(); @@ -71,7 +73,6 @@ class StreamHandler extends AbstractProcessingHandler fwrite($this->stream, (string) $record['formatted']); } - private $errorMessage = null; protected function customErrorHandler($code, $msg) { $this->errorMessage = preg_replace('{^fopen\(.*?\): }', '', $msg); }