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();
36var_dump($tester->getLastLogLine() === str_repeat('a', 100) . str_repeat('b', 923) . "\n");
37var_dump($tester->getLastLogLine() === str_repeat('b', 1023) . "\n");
38var_dump($tester->getLastLogLine() === str_repeat('b', 554) . "\n");
39$tester->close();
40
41?>
42Done
43--EXPECT--
44bool(true)
45bool(true)
46bool(true)
47Done
48--CLEAN--
49<?php
50require_once "tester.inc";
51FPM\Tester::clean();
52?>
53