Want more features on Pastebin? Sign Up, it's FREE!
Guest

icheishvili

By: a guest on Sep 28th, 2008  |  syntax: PHP  |  size: 0.61 KB  |  views: 295  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. --TEST--
  2. bug#46146 (stream_filter_remove() closes the stream)
  3. --FILE--
  4. <?php
  5. class user_filter extends php_user_filter {
  6.         function filter($in, $out, &$consumed, $closing) {
  7.                 while($bucket = stream_bucket_make_writeable($in)) {
  8.                         $consumed += $bucket->datalen;
  9.                         stream_bucket_append($out, $bucket);
  10.                 }
  11.         return PSFS_PASS_ON;
  12.         }
  13. }
  14. stream_filter_register('user_filter','user_filter');
  15.  
  16. $fd = fopen('bug46146.txt','w');
  17. $filter = stream_filter_append($fd, 'user_filter');
  18. ?>
  19. --CLEAN--
  20. <?php
  21. unlink('bug46146.txt');
  22. ?>
  23. --EXPECT--
  24. bool(true)
clone this paste RAW Paste Data