mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-08 06:06:40 +02:00
Avoid infinite loops when no data is written on a socket for a time greater than writingTimeout settings
This commit is contained in:
@@ -235,6 +235,26 @@ class SocketHandlerTest extends TestCase
|
||||
$this->assertTrue(is_resource($this->res));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
*/
|
||||
public function testAvoidInfiniteLoopWhenNoDataIsWrittenForAWritingTimeoutSeconds()
|
||||
{
|
||||
$this->setMockHandler(array('fwrite', 'streamGetMetadata'));
|
||||
|
||||
$this->handler->expects($this->any())
|
||||
->method('fwrite')
|
||||
->will($this->returnValue(0));
|
||||
|
||||
$this->handler->expects($this->any())
|
||||
->method('streamGetMetadata')
|
||||
->will($this->returnValue(array('timed_out' => false)));
|
||||
|
||||
$this->handler->setWritingTimeout(1);
|
||||
|
||||
$this->writeRecord('Hello world');
|
||||
}
|
||||
|
||||
private function createHandler($connectionString)
|
||||
{
|
||||
$this->handler = new SocketHandler($connectionString);
|
||||
|
Reference in New Issue
Block a user