1--TEST--
2Test stream_filter_remove() function : basic functionality
3--SKIPIF--
4<?php
5$filters = stream_get_filters();
6if(! in_array( "string.rot13", $filters )) die( "skip rot13 filter not available." );
7?>
8--FILE--
9<?php
10/* Prototype  : bool stream_filter_remove(resource stream_filter)
11 * Description: Flushes any data in the filter's internal buffer, removes it from the chain, and frees the resource
12 * Source code: ext/standard/streamsfuncs.c
13 * Alias to functions:
14 */
15
16echo "*** Testing stream_filter_remove() : basic functionality ***\n";
17
18$file = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'streamfilterTest.txt';
19touch( $file );
20
21$fp = fopen( $file, 'w+' );
22
23$filter = stream_filter_append( $fp, "string.rot13", STREAM_FILTER_WRITE );
24fwrite( $fp, "Testing the rot13 filter which shifts some things around." );
25
26var_dump( stream_filter_remove( $filter ) );
27fwrite( $fp, "\nadd some more un-filtered foobar\n" );
28
29rewind( $fp );
30fpassthru( $fp );
31fclose( $fp );
32
33?>
34===DONE===
35--CLEAN--
36<?php
37
38$file = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'streamfilterTest.txt';
39unlink( $file );
40
41?>
42--EXPECTF--
43*** Testing stream_filter_remove() : basic functionality ***
44bool(true)
45Grfgvat gur ebg13 svygre juvpu fuvsgf fbzr guvatf nebhaq.
46add some more un-filtered foobar
47===DONE===
48