summaryrefslogtreecommitdiff
path: root/ext/standard/tests/file/bug39551.phpt
blob: c3d011351e28e60ff0ac2068809f572267155709 (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
--TEST--
Bug #39551 (Segfault with stream_bucket_new in user filter)
--FILE--
<?php

$bucket = stream_bucket_new(fopen('php://temp', 'w+'), '');

class bucketFilter {
    public function filter($in, $out, &$consumed, $closing ){

        $bucket = stream_bucket_new(fopen('php://temp', 'w+'), '');
        stream_bucket_append($out, $bucket);
        return PSFS_PASS_ON;
    }
}

stream_filter_register('bucketfault', 'bucketFilter');
stream_filter_append($s = fopen('php://temp', 'r+'), 'bucketfault');
stream_get_contents($s);

echo "Done\n";
?>
--EXPECT--
Done