1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-01 10:50:21 +02:00

Auto-close streams when reset() is called, fixes #1862

This commit is contained in:
Jordi Boggiano
2024-11-11 20:20:56 +01:00
parent 24a1110715
commit 0c7366171f

View File

@@ -79,6 +79,20 @@ class StreamHandler extends AbstractProcessingHandler
$this->useLocking = $useLocking;
}
/**
* @inheritDoc
*/
public function reset(): void
{
parent::reset();
// auto-close on reset to make sure we periodically close the file in long running processes
// as long as they correctly call reset() between jobs
if ($this->url !== null && $this->url !== 'php://memory') {
$this->close();
}
}
/**
* @inheritDoc
*/