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

Merge branch '2.x' into main

This commit is contained in:
Jordi Boggiano
2022-05-08 23:03:49 +02:00
31 changed files with 697 additions and 182 deletions

View File

@@ -270,20 +270,20 @@ STRING;
$this->markTestSkipped('We could not set a memory limit that would trigger the error.');
}
$stream = tmpfile();
try {
$stream = tmpfile();
if ($stream === false) {
$this->markTestSkipped('We could not create a temp file to be use as a stream.');
if ($stream === false) {
$this->markTestSkipped('We could not create a temp file to be use as a stream.');
}
$handler = new StreamHandler($stream);
stream_get_contents($stream, 1024);
$this->assertEquals($expectedChunkSize, $handler->getStreamChunkSize());
} finally {
ini_set('memory_limit', $previousValue);
}
$exceptionRaised = false;
$handler = new StreamHandler($stream);
stream_get_contents($stream, 1024);
ini_set('memory_limit', $previousValue);
$this->assertEquals($expectedChunkSize, $handler->getStreamChunkSize());
}
public function testSimpleOOMPrevention(): void
@@ -294,10 +294,13 @@ STRING;
$this->markTestSkipped('We could not set a memory limit that would trigger the error.');
}
$stream = tmpfile();
new StreamHandler($stream);
stream_get_contents($stream);
ini_set('memory_limit', $previousValue);
$this->assertTrue(true);
try {
$stream = tmpfile();
new StreamHandler($stream);
stream_get_contents($stream);
$this->assertTrue(true);
} finally {
ini_set('memory_limit', $previousValue);
}
}
}