xref: /PHP-8.3/tests/lang/bug24951.phpt (revision f8d79582)
1--TEST--
2Bug #24951 (ob_flush() destroys output handler)
3--FILE--
4<?php
5function test($s, $mode)
6{
7    return (($mode & PHP_OUTPUT_HANDLER_START)?"[":"") . $s . (($mode & PHP_OUTPUT_HANDLER_END)?"]\n":"");
8}
9function t1()
10{
11    ob_start("test");
12    echo "Hello from t1 1 ";
13        echo "Hello from t1 2 ";
14        ob_end_flush();
15}
16function t2()
17{
18    ob_start("test");
19    echo "Hello from t2 1 ";
20        ob_flush();
21        echo "Hello from t2 2 ";
22        ob_end_flush();
23}
24function t3()
25{
26    ob_start("test");
27        echo "Hello from t3 1 ";
28        ob_clean();
29        echo "Hello from t3 2 ";
30        ob_end_flush();
31}
32
33t1(); echo "\n";
34t2(); echo "\n";
35t3(); echo "\n";
36?>
37--EXPECT--
38[Hello from t1 1 Hello from t1 2 ]
39
40[Hello from t2 1 Hello from t2 2 ]
41
42Hello from t3 2 ]
43