Return to stream_filter_remove_basic.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / filters |
1.1 misho 1: --TEST-- 2: Test stream_filter_remove() function : basic functionality 3: --SKIPIF-- 4: <?php 5: $filters = stream_get_filters(); 6: if(! 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: 16: echo "*** Testing stream_filter_remove() : basic functionality ***\n"; 17: 18: $file = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'streamfilterTest.txt'; 19: touch( $file ); 20: 21: $fp = fopen( $file, 'w+' ); 22: 23: $filter = stream_filter_append( $fp, "string.rot13", STREAM_FILTER_WRITE ); 24: fwrite( $fp, "Testing the rot13 filter which shifts some things around." ); 25: 26: var_dump( stream_filter_remove( $filter ) ); 27: fwrite( $fp, "\nadd some more un-filtered foobar\n" ); 28: 29: rewind( $fp ); 30: fpassthru( $fp ); 31: fclose( $fp ); 32: 33: ?> 34: ===DONE=== 35: --CLEAN-- 36: <?php 37: 38: $file = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'streamfilterTest.txt'; 39: unlink( $file ); 40: 41: ?> 42: --EXPECTF-- 43: *** Testing stream_filter_remove() : basic functionality *** 44: bool(true) 45: Grfgvat gur ebg13 svygre juvpu fuvsgf fbzr guvatf nebhaq. 46: add some more un-filtered foobar 47: ===DONE===