1--TEST--
2FPM: bug81513 - Buffered worker output plain log stream reallocation
3--SKIPIF--
4<?php include "skipif.inc"; ?>
5--FILE--
6<?php
7
8require_once "tester.inc";
9
10$cfg = <<<EOT
11[global]
12error_log = {{FILE:LOG}}
13[unconfined]
14listen = {{ADDR}}
15pm = dynamic
16pm.max_children = 5
17pm.start_servers = 1
18pm.min_spare_servers = 1
19pm.max_spare_servers = 3
20catch_workers_output = yes
21decorate_workers_output = no
22EOT;
23
24$code = <<<EOT
25<?php
26file_put_contents('php://stderr', str_repeat('a', 100));
27usleep(20000);
28file_put_contents('php://stderr', str_repeat('b', 2500) . "\n");
29EOT;
30
31$tester = new FPM\Tester($cfg, $code);
32$tester->start();
33$tester->expectLogStartNotices();
34$tester->request()->expectEmptyBody();
35$tester->terminate();
36$tester->expectLogLine(str_repeat('a', 100)  . str_repeat('b', 923), decorated: false);
37$tester->expectLogLine(str_repeat('b', 1023), decorated: false);
38$tester->expectLogLine(str_repeat('b', 554), decorated: false);
39$tester->close();
40
41?>
42Done
43--EXPECT--
44Done
45--CLEAN--
46<?php
47require_once "tester.inc";
48FPM\Tester::clean();
49?>
50