log-bwp-realloc-buffer.phpt 1.0 KB

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