Created
June 30, 2018 08:23
-
-
Save rottenoats/4c46617329e8a6e1be66dc8561218788 to your computer and use it in GitHub Desktop.
Monolog Streamhandler Write Method (line 18 is where it fails and throws exception)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* {@inheritdoc} | |
*/ | |
protected function write(array $record) | |
{ | |
if (!is_resource($this->stream)) { | |
if (null === $this->url || '' === $this->url) { | |
throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().'); | |
} | |
$this->createDir(); | |
$this->errorMessage = null; | |
set_error_handler(array($this, 'customErrorHandler')); | |
$this->stream = fopen($this->url, 'a'); | |
if ($this->filePermission !== null) { | |
@chmod($this->url, $this->filePermission); | |
} | |
restore_error_handler(); | |
if (!is_resource($this->stream)) { | |
$this->stream = null; | |
throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened: '.$this->errorMessage, $this->url)); | |
} | |
} | |
if ($this->useLocking) { | |
// ignoring errors here, there's not much we can do about them | |
flock($this->stream, LOCK_EX); | |
} | |
$this->streamWrite($this->stream, $record); | |
if ($this->useLocking) { | |
flock($this->stream, LOCK_UN); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Scope isolated include. | |
* | |
* Prevents access to $this/self from included files. | |
*/ | |
function includeFile($file) | |
{ | |
include $file; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment