mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-01 10:50:21 +02:00
Ensure private error handler does not cause problems, fixes #1866
This commit is contained in:
@@ -134,7 +134,9 @@ class StreamHandler extends AbstractProcessingHandler
|
|||||||
}
|
}
|
||||||
$this->createDir($url);
|
$this->createDir($url);
|
||||||
$this->errorMessage = null;
|
$this->errorMessage = null;
|
||||||
set_error_handler([$this, 'customErrorHandler']);
|
set_error_handler(function (...$args) {
|
||||||
|
return $this->customErrorHandler(...$args);
|
||||||
|
});
|
||||||
try {
|
try {
|
||||||
$stream = fopen($url, 'a');
|
$stream = fopen($url, 'a');
|
||||||
if ($this->filePermission !== null) {
|
if ($this->filePermission !== null) {
|
||||||
@@ -212,7 +214,9 @@ class StreamHandler extends AbstractProcessingHandler
|
|||||||
$dir = $this->getDirFromStream($url);
|
$dir = $this->getDirFromStream($url);
|
||||||
if (null !== $dir && !is_dir($dir)) {
|
if (null !== $dir && !is_dir($dir)) {
|
||||||
$this->errorMessage = null;
|
$this->errorMessage = null;
|
||||||
set_error_handler([$this, 'customErrorHandler']);
|
set_error_handler(function (...$args) {
|
||||||
|
return $this->customErrorHandler(...$args);
|
||||||
|
});
|
||||||
$status = mkdir($dir, 0777, true);
|
$status = mkdir($dir, 0777, true);
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
if (false === $status && !is_dir($dir) && strpos((string) $this->errorMessage, 'File exists') === false) {
|
if (false === $status && !is_dir($dir) && strpos((string) $this->errorMessage, 'File exists') === false) {
|
||||||
|
Reference in New Issue
Block a user