bug76249.phpt 606 B

12345678910111213141516171819
  1. --TEST--
  2. Bug #76249 (stream filter convert.iconv leads to infinite loop on invalid sequence)
  3. --EXTENSIONS--
  4. iconv
  5. --FILE--
  6. <?php
  7. $fh = fopen('php://memory', 'rw');
  8. fwrite($fh, "abc");
  9. rewind($fh);
  10. if (false === @stream_filter_append($fh, 'convert.iconv.ucs-2/utf8//IGNORE', STREAM_FILTER_READ, [])) {
  11. stream_filter_append($fh, 'convert.iconv.ucs-2/utf-8//IGNORE', STREAM_FILTER_READ, []);
  12. }
  13. var_dump(stream_get_contents($fh));
  14. ?>
  15. DONE
  16. --EXPECTF--
  17. Warning: stream_get_contents(): iconv stream filter ("ucs-2"=>"utf%A8//IGNORE"): invalid multibyte sequence in %sbug76249.php on line %d
  18. string(0) ""
  19. DONE