summaryrefslogtreecommitdiff
path: root/tests/lang/bug30578.phpt
blob: dc9eeeaae4c5479b400d3f6b04a347af6ee3553d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--TEST--
Bug #30578 (Output buffers flushed before calling __desctruct functions)
--FILE--
<?php

error_reporting(E_ALL);

class Example
{
    function __construct()
    {
        ob_start();
        echo "This should be displayed last.\n";
    }

    function __destruct()
    {
        $buffered_data = ob_get_contents();
        ob_end_clean();

        echo "This should be displayed first.\n";
        echo "Buffered data: $buffered_data";
    }
}

$obj = new Example;

?>
--EXPECT--
This should be displayed first.
Buffered data: This should be displayed last.