xref: /PHP-8.3/tests/output/bug60768.phpt (revision d679f022)
1--TEST--
2Bug #60768 Output buffer not discarded
3--FILE--
4<?php
5
6global $storage;
7
8ob_start(function($buffer) use (&$storage) { $storage .= $buffer; }, 20);
9
10echo str_repeat("0", 20); // fill in the buffer
11
12for($i = 0; $i < 10; $i++) {
13    echo str_pad($i, 9, ' ', STR_PAD_LEFT) . "\n"; // full buffer dumped every time
14}
15
16ob_end_flush();
17
18printf("Output size: %d, expected %d\n", strlen($storage), 20 + 10 * 10);
19
20?>
21DONE
22--EXPECT--
23Output size: 120, expected 120
24DONE
25